B
Bill Guindon
I ran ZenTest against the following code:
module SomeDB
class Field
attr_accessor :name, :type, :size
def initialize(name, type, size=3D0)
@name =3D name
@type =3D type
@size =3D size
end
def to_s
[@name, @type] << @size unless @size =3D=3D 0
end
end
end
And it produced the following test code:
# Code Generated by ZenTest v. 2.3.0
# classname: asrt / meth =3D ratio%
# SomeDB::Field: 0 / 2 =3D 0.00%
require 'test/unit' unless defined? $ZENTEST and $ZENTEST
module TestSomeDB
class TestField < Test::Unit::TestCase
def test_name_equals
raise NotImplementedError, 'Need to write test_name_equals'
end
def test_size
raise NotImplementedError, 'Need to write test_size'
end
def test_size_equals
raise NotImplementedError, 'Need to write test_size_equals'
end
def test_type_equals
raise NotImplementedError, 'Need to write test_type_equals'
end
end
end
# Number of errors detected: 2
Any idea why it didn't create stubs for 'test_name' and 'test_size'?=20
Shouldn't it have also created a stub for 'test_to_s'?
TIA
--=20
Bill Guindon (aka aGorilla)
module SomeDB
class Field
attr_accessor :name, :type, :size
def initialize(name, type, size=3D0)
@name =3D name
@type =3D type
@size =3D size
end
def to_s
[@name, @type] << @size unless @size =3D=3D 0
end
end
end
And it produced the following test code:
# Code Generated by ZenTest v. 2.3.0
# classname: asrt / meth =3D ratio%
# SomeDB::Field: 0 / 2 =3D 0.00%
require 'test/unit' unless defined? $ZENTEST and $ZENTEST
module TestSomeDB
class TestField < Test::Unit::TestCase
def test_name_equals
raise NotImplementedError, 'Need to write test_name_equals'
end
def test_size
raise NotImplementedError, 'Need to write test_size'
end
def test_size_equals
raise NotImplementedError, 'Need to write test_size_equals'
end
def test_type_equals
raise NotImplementedError, 'Need to write test_type_equals'
end
end
end
# Number of errors detected: 2
Any idea why it didn't create stubs for 'test_name' and 'test_size'?=20
Shouldn't it have also created a stub for 'test_to_s'?
TIA
--=20
Bill Guindon (aka aGorilla)