From zenspider at rubyforge.org Thu Mar 10 03:59:30 2005 From: zenspider at rubyforge.org (zenspider@rubyforge.org) Date: Thu Mar 10 03:59:31 2005 Subject: [Rubytests-commit] rubicon GNUmakefile Message-ID: <200503100859.j2A8xUdS024036@rubyforge.org> Update of /var/cvs/rubytests/rubicon In directory rubyforge.org:/tmp/cvs-serv24032 Modified Files: GNUmakefile Log Message: refactored makefile to have a tools rule Index: GNUmakefile =================================================================== RCS file: /var/cvs/rubytests/rubicon/GNUmakefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** GNUmakefile 13 Feb 2004 15:35:11 -0000 1.1.1.1 --- GNUmakefile 10 Mar 2005 08:59:28 -0000 1.2 *************** *** 22,29 **** default: test ! ! test: $(UTILSTUFF) $(RUBY) AllTests.rb Builtin: $(UTILSTUFF) cd builtin && $(RUBY) AllBuiltinTests.rb --- 22,30 ---- default: test ! test: tools $(RUBY) AllTests.rb + tools: $(UTILSTUFF) + Builtin: $(UTILSTUFF) cd builtin && $(RUBY) AllBuiltinTests.rb From zenspider at rubyforge.org Thu Mar 10 03:59:56 2005 From: zenspider at rubyforge.org (zenspider@rubyforge.org) Date: Thu Mar 10 03:59:57 2005 Subject: [Rubytests-commit] rubicon rubicon_tests.rb Message-ID: <200503100859.j2A8xudS024057@rubyforge.org> Update of /var/cvs/rubytests/rubicon In directory rubyforge.org:/tmp/cvs-serv24053 Modified Files: rubicon_tests.rb Log Message: fixed order of assert_equal in truth_table tests Index: rubicon_tests.rb =================================================================== RCS file: /var/cvs/rubytests/rubicon/rubicon_tests.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** rubicon_tests.rb 5 Jan 2005 10:19:05 -0000 1.11 --- rubicon_tests.rb 10 Mar 2005 08:59:54 -0000 1.12 *************** *** 113,119 **** def truth_table(method, *result) for a in [ false, true ] ! res = result.shift ! assert_equal(method.call(a), res) ! assert_equal(method.call(a ? self : nil), res) end end --- 113,119 ---- def truth_table(method, *result) for a in [ false, true ] ! expected = result.shift ! assert_equal(expected, method.call(a)) ! assert_equal(expected, method.call(a ? self : nil)) end end From neoneye at rubyforge.org Thu Mar 10 13:33:56 2005 From: neoneye at rubyforge.org (neoneye@rubyforge.org) Date: Thu Mar 10 13:33:56 2005 Subject: [Rubytests-commit] rubicon/builtin TestKernel.rb Message-ID: <200503101833.j2AIXudS030057@rubyforge.org> Update of /var/cvs/rubytests/rubicon/builtin In directory rubyforge.org:/tmp/cvs-serv29855/rubicon/builtin Modified Files: TestKernel.rb Log Message: I have gotten a Mac Mini, so I decided to try out rubicon. For some reason Rubicon got a bus error in builtin/TestKernel.rb#test_s_open2. I have disabled this test for MacOS, so that rubicon doesn't terminate suddenly. Status on MacOS: All 71 files FAIL 955 23352 2 0 Index: TestKernel.rb =================================================================== RCS file: /var/cvs/rubytests/rubicon/builtin/TestKernel.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TestKernel.rb 15 Jan 2005 22:57:51 -0000 1.11 --- TestKernel.rb 10 Mar 2005 18:33:54 -0000 1.12 *************** *** 1285,1288 **** --- 1285,1294 ---- # pipes def test_s_open2 + #$stderr.puts "os="#{$os.inspect}" + #if $os == MacOS + # $stderr.puts "skippping" + # skipping("pipe problems on mac") + # return + #end setup_s_open2 *************** *** 1397,1400 **** --- 1403,1410 ---- end + MacOS.only do + undef test_s_open2 + end + def test_s_p From neoneye at rubyforge.org Thu Mar 10 13:36:34 2005 From: neoneye at rubyforge.org (neoneye@rubyforge.org) Date: Thu Mar 10 13:36:35 2005 Subject: [Rubytests-commit] rubicon/builtin TestKernel.rb Message-ID: <200503101836.j2AIaYdS030133@rubyforge.org> Update of /var/cvs/rubytests/rubicon/builtin In directory rubyforge.org:/tmp/cvs-serv30124/builtin Modified Files: TestKernel.rb Log Message: sigh.. I forgot to disable some temporary code while attempting to figure out why rubicon failed completing on macosx. Index: TestKernel.rb =================================================================== RCS file: /var/cvs/rubytests/rubicon/builtin/TestKernel.rb,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TestKernel.rb 10 Mar 2005 18:33:54 -0000 1.12 --- TestKernel.rb 10 Mar 2005 18:36:32 -0000 1.13 *************** *** 1285,1294 **** # pipes def test_s_open2 - #$stderr.puts "os="#{$os.inspect}" - #if $os == MacOS - # $stderr.puts "skippping" - # skipping("pipe problems on mac") - # return - #end setup_s_open2 --- 1285,1288 ---- From neoneye at rubyforge.org Thu Mar 10 13:45:29 2005 From: neoneye at rubyforge.org (neoneye@rubyforge.org) Date: Thu Mar 10 13:45:30 2005 Subject: [Rubytests-commit] rubicon ChangeLog Message-ID: <200503101845.j2AIjTdS030445@rubyforge.org> Update of /var/cvs/rubytests/rubicon In directory rubyforge.org:/tmp/cvs-serv30431 Modified Files: ChangeLog Log Message: changes to builtin/TestKernel.rb Index: ChangeLog =================================================================== RCS file: /var/cvs/rubytests/rubicon/ChangeLog,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ChangeLog 8 Feb 2005 12:45:12 -0000 1.20 --- ChangeLog 10 Mar 2005 18:45:27 -0000 1.21 *************** *** 1,2 **** --- 1,12 ---- + 2005-03-10 19:30 neoneye + + * builtin/TestKernel.rb: + + I have gotten a Mac Mini, so I decided to try out rubicon. + For some reason Rubicon got a bus error in + builtin/TestKernel.rb#test_s_open2. I have disabled this test for MacOS, + so that rubicon doesn't terminate suddenly. Status on MacOS: + All 71 files FAIL 955 23352 2 0 + 2005-02-08 13:42 holmberg From zenspider at rubyforge.org Wed Mar 23 19:54:09 2005 From: zenspider at rubyforge.org (zenspider@rubyforge.org) Date: Wed Mar 23 19:54:10 2005 Subject: [Rubytests-commit] rubicon rubicon_tests.rb Message-ID: <200503240054.j2O0s9dS031194@rubyforge.org> Update of /var/cvs/rubytests/rubicon In directory rubyforge.org:/tmp/cvs-serv31190 Modified Files: rubicon_tests.rb Log Message: Modified to properly do filtering (-n works on cmdline) and exit non-zero if failed. r:neoneye Index: rubicon_tests.rb =================================================================== RCS file: /var/cvs/rubytests/rubicon/rubicon_tests.rb,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** rubicon_tests.rb 10 Mar 2005 08:59:54 -0000 1.12 --- rubicon_tests.rb 24 Mar 2005 00:54:06 -0000 1.13 *************** *** 30,34 **** suite = Test::Unit::TestSuite.new ARGV.each do |testmethod| ! suite << testClass.new(testmethod) end end --- 30,36 ---- suite = Test::Unit::TestSuite.new ARGV.each do |testmethod| ! catch(:invalid_test) do ! suite << testClass.new(testmethod) ! end end end *************** *** 36,39 **** --- 38,43 ---- testrunner = Rubicon::TestRunner.new(suite, Test::Unit::UI::VERBOSE) results = testrunner.start + + exit(results.error_count + results.failure_count > 0 ? 1 : 0) end From zenspider at rubyforge.org Wed Mar 23 19:54:14 2005 From: zenspider at rubyforge.org (zenspider@rubyforge.org) Date: Wed Mar 23 19:54:14 2005 Subject: [Rubytests-commit] rubicon/builtin TestFalseClass.rb TestNilClass.rb TestTrueClass.rb Message-ID: <200503240054.j2O0sEdS031206@rubyforge.org> Update of /var/cvs/rubytests/rubicon/builtin In directory rubyforge.org:/tmp/cvs-serv31202/builtin Modified Files: TestFalseClass.rb TestNilClass.rb TestTrueClass.rb Log Message: Changed test method names to be auditable by ZenTest. r:neoneye Index: TestNilClass.rb =================================================================== RCS file: /var/cvs/rubytests/rubicon/builtin/TestNilClass.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestNilClass.rb 21 Nov 2004 07:15:40 -0000 1.2 --- TestNilClass.rb 24 Mar 2005 00:54:12 -0000 1.3 *************** *** 5,9 **** class TestNilClass < Rubicon::TestCase ! def test_AND # '&' truth_table(nil.method("&"), false, false) end --- 5,9 ---- class TestNilClass < Rubicon::TestCase ! def test_and # '&' truth_table(nil.method("&"), false, false) end *************** *** 13,17 **** end ! def test_OR # '|' truth_table(nil.method("|"), false, true) $global = 0 --- 13,17 ---- end ! def test_or # '|' truth_table(nil.method("|"), false, true) $global = 0 *************** *** 20,24 **** end ! def test_XOR # '^' truth_table(nil.method("^"), false, true) $global = 0 --- 20,24 ---- end ! def test_carat # '^' truth_table(nil.method("^"), false, true) $global = 0 Index: TestFalseClass.rb =================================================================== RCS file: /var/cvs/rubytests/rubicon/builtin/TestFalseClass.rb,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TestFalseClass.rb 13 Feb 2004 15:35:13 -0000 1.1.1.1 --- TestFalseClass.rb 24 Mar 2005 00:54:12 -0000 1.2 *************** *** 5,21 **** class TestFalseClass < Rubicon::TestCase ! def test_00_sanity assert_equal(false, FALSE) end ! def test_AND # '&' truth_table(false.method("&"), false, false) end ! def test_OR # '|' truth_table(false.method("|"), false, true) end ! def test_XOR # '^' truth_table(false.method("^"), false, true) end --- 5,21 ---- class TestFalseClass < Rubicon::TestCase ! def test_00sanity assert_equal(false, FALSE) end ! def test_and # '&' truth_table(false.method("&"), false, false) end ! def test_or # '|' truth_table(false.method("|"), false, true) end ! def test_carat # '^' truth_table(false.method("^"), false, true) end Index: TestTrueClass.rb =================================================================== RCS file: /var/cvs/rubytests/rubicon/builtin/TestTrueClass.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestTrueClass.rb 13 Feb 2004 16:46:00 -0000 1.2 --- TestTrueClass.rb 24 Mar 2005 00:54:12 -0000 1.3 *************** *** 9,21 **** end ! def test_AND # '&' truth_table(true.method("&"), false, true) end ! def test_OR # '|' truth_table(true.method("|"), true, true) end ! def test_XOR # '^' truth_table(true.method("^"), true, false) end --- 9,21 ---- end ! def test_and # '&' truth_table(true.method("&"), false, true) end ! def test_or # '|' truth_table(true.method("|"), true, true) end ! def test_carat # '^' truth_table(true.method("^"), true, false) end From zenspider at rubyforge.org Wed Mar 23 19:54:19 2005 From: zenspider at rubyforge.org (zenspider@rubyforge.org) Date: Wed Mar 23 19:54:21 2005 Subject: [Rubytests-commit] rubicon/builtin TestTime.rb Message-ID: <200503240054.j2O0sJdS031219@rubyforge.org> Update of /var/cvs/rubytests/rubicon/builtin In directory rubyforge.org:/tmp/cvs-serv31215/builtin Modified Files: TestTime.rb Log Message: Fixed a bunch of tests (eg using assert instead of assert_equal), renamed the methods and tagged classes for ZenTest, run and merged in an audit's results, and put some flunks in where the tests were deficient (eg to_s uses strftime to test). What I haven't done is improved the situation in here at all (yet). r:neoneye Index: TestTime.rb =================================================================== RCS file: /var/cvs/rubytests/rubicon/builtin/TestTime.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TestTime.rb 28 Dec 2004 09:07:38 -0000 1.5 --- TestTime.rb 24 Mar 2005 00:54:17 -0000 1.6 *************** *** 6,10 **** # ! class T attr :orig attr :amt --- 6,10 ---- # ! class T # ZenTest SKIP attr :orig attr :amt *************** *** 90,98 **** def checkComponent(m, i) @@dates.each do |x| ! msg = "\nTesting method Time."+m.id2name+" with "+x.orig.join(' ')+":\n" ! assert_equal(x.orig[i], Time.local(*x.orig).send(m), msg) ! assert_equal(x.result[i], Time.local(*x.result).send(m), msg) ! assert_equal(x.orig[i], Time.gm(*x.orig).send(m), msg) ! assert_equal(x.result[i], Time.gm(*x.result).send(m), msg) end end --- 90,105 ---- def checkComponent(m, i) @@dates.each do |x| ! assert_equal(x.orig[i], Time.local(*x.orig).send(m)) ! assert_equal(x.result[i], Time.local(*x.result).send(m)) ! assert_equal(x.orig[i], Time.gm(*x.orig).send(m)) ! assert_equal(x.result[i], Time.gm(*x.result).send(m)) ! end ! end ! ! def os_specific_epoch ! if $os == MsWin32 || $os == JRuby ! "Thu Jan 01 00:00:00 1970" ! else ! "Thu Jan 1 00:00:00 1970" end end *************** *** 101,155 **** # Ensure against time travel # ! def test_00sanity ! Time.now.to_i > 960312287 # Tue Jun 6 13:25:06 EDT 2000 end ! # Method tests: ! def test_CMP # '<=>' ! @@dates.each do |x| ! if (x.amt != 0) ! assert_equal(1, Time.local(*x.result) <=> Time.local(*x.orig), ! "#{x.result} should be > #{x.orig}") ! assert_equal(-1, Time.local(*x.orig) <=> Time.local(*x.result)) ! assert_equal(0, Time.local(*x.orig) <=> Time.local(*x.orig)) ! assert_equal(0, Time.local(*x.result) <=> Time.local(*x.result)) ! ! assert_equal(1,Time.gm(*x.result) <=> Time.gm(*x.orig)) ! assert_equal(-1,Time.gm(*x.orig) <=> Time.gm(*x.result)) ! assert_equal(0,Time.gm(*x.orig) <=> Time.gm(*x.orig)) ! assert_equal(0,Time.gm(*x.result) <=> Time.gm(*x.result)) ! end end end ! def test_MINUS # '-' ! @@dates.each do |x| ! # Check subtracting an amount in seconds ! assert_equal(Time.local(*x.result) - x.amt, Time.local(*x.orig)) ! assert_equal(Time.gm(*x.result) - x.amt, Time.gm(*x.orig)) ! # Check subtracting two times ! assert_equal(Time.local(*x.result) - Time.local(*x.orig), x.amt) ! assert_equal(Time.gm(*x.result) - Time.gm(*x.orig), x.amt) end end ! def test_PLUS # '+' ! @@dates.each do |x| ! assert_equal(Time.local(*x.orig) + x.amt, Time.local(*x.result)) ! assert_equal(Time.gm(*x.orig) + x.amt, Time.gm(*x.result)) end end ! def test__dump end ! def os_specific_epoch ! if $os == MsWin32 || $os == JRuby ! "Thu Jan 01 00:00:00 1970" ! else ! "Thu Jan 1 00:00:00 1970" end end --- 108,246 ---- # Ensure against time travel # ! def test_00sanity # ZenTest SKIP ! assert_operator Time.now.to_i, :>, 960312287 # Tue Jun 6 13:25:06 EDT 2000 end ! # Class methods: ! def test_class__load ! raise NotImplementedError, 'Need to write test_class__load' ! end ! def test_class_at ! t = Time.now ! sec = t.to_i ! assert_equal(0, Time.at(0).to_i) ! assert_equal(t, Time.at(t)) ! assert((Time.at(sec,1000000).to_f - Time.at(sec).to_f) == 1.0) ! end ! ! def test_class_gm ! assert_raises(ArgumentError) { Time.gm } ! assert(Time.gm(2000) != Time.local(2000)) ! assert_equal(Time.gm(2000), Time.gm(2000,1,1,0,0,0)) ! assert_equal(Time.gm(2000,nil,nil,nil,nil,nil), Time.gm(2000,1,1,0,0,0)) ! assert_raises(ArgumentError) { Time.gm(2000,0) } ! assert_raises(ArgumentError) { Time.gm(2000,13) } ! assert_raises(ArgumentError) { Time.gm(2000,1,1,24) } ! Time.gm(2000,1,1,23) ! @@months.each do |month, num| ! assert_equal(Time.gm(2000,month), Time.gm(2000,num,1,0,0,0)) ! assert_equal(Time.gm(1970,month), Time.gm(1970,num,1,0,0,0)) ! assert_equal(Time.gm(2037,month), Time.gm(2037,num,1,0,0,0)) end + t = Time.gm(2000,1,1) + a = t.to_a + assert_equal(Time.gm(*a),t) end ! def test_class_httpdate ! raise NotImplementedError, 'Need to write test_class_httpdate' ! end ! ! def test_class_iso8601 ! raise NotImplementedError, 'Need to write test_class_iso8601' ! end ! ! def test_class_local ! assert_raises(ArgumentError) { Time.local } ! assert(Time.gm(2000) != Time.local(2000)) ! assert_equal(Time.local(2000), Time.local(2000,1,1,0,0,0)) ! assert_equal(Time.local(2000,nil,nil,nil,nil,nil), Time.local(2000,1,1,0,0,0)) ! assert_raises(ArgumentError) { Time.local(2000,0) } ! assert_raises(ArgumentError) { Time.local(2000,13) } ! assert_raises(ArgumentError) { Time.local(2000,1,1,24) } ! Time.local(2000,1,1,23) ! @@months.each do |month, num| ! assert_equal(Time.local(2000,month), Time.local(2000,num,1,0,0,0)) ! assert_equal(Time.local(1971,month), Time.local(1971,num,1,0,0,0)) ! assert_equal(Time.local(2037,month), Time.local(2037,num,1,0,0,0)) end + t = Time.local(2000,1,1) + a = t.to_a + assert_equal(Time.local(*a),t) end ! def test_class_mktime ! # ! # Test insufficient arguments ! # ! assert_raises(ArgumentError) { Time.mktime } ! assert(Time.gm(2000) != Time.mktime(2000)) ! assert_equal(Time.mktime(2000), Time.mktime(2000,1,1,0,0,0)) ! assert_equal(Time.mktime(2000,nil,nil,nil,nil,nil), Time.mktime(2000,1,1,0,0,0)) ! assert_raises(ArgumentError) { Time.mktime(2000,0) } ! assert_raises(ArgumentError) { Time.mktime(2000,13) } ! assert_raises(ArgumentError) { Time.mktime(2000,1,1,24) } ! Time.mktime(2000,1,1,23) ! ! # ! # Make sure spelled-out month names work ! # ! @@months.each do |month, num| ! assert_equal(Time.mktime(2000,month), Time.mktime(2000,num,1,0,0,0)) ! assert_equal(Time.mktime(1971,month), Time.mktime(1971,num,1,0,0,0)) ! assert_equal(Time.mktime(2037,month), Time.mktime(2037,num,1,0,0,0)) end + t = Time.mktime(2000,1,1) + a = t.to_a + assert_equal(Time.mktime(*a),t) end ! def test_class_now ! t1 = Time.now ! sleep 1 ! t2 = Time.now ! d = t2.to_f - t1.to_f ! assert(d > 0.9 && d < 1.1) end ! def test_class_parse ! raise NotImplementedError, 'Need to write test_class_parse' ! end ! ! def test_class_rfc2822 ! raise NotImplementedError, 'Need to write test_class_rfc2822' ! end ! ! def test_class_rfc822 ! raise NotImplementedError, 'Need to write test_class_rfc822' ! end ! ! def test_class_times ! Version.less_than("1.7") do ! assert_instance_of(Struct::Tms, Time.times) end + Version.greater_or_equal("1.7") do + assert_instance_of(Struct::Tms, Process.times) + end + end + + def test_class_utc + raise NotImplementedError, 'Need to write test_class_utc' + end + + def test_class_xmlschema + raise NotImplementedError, 'Need to write test_class_xmlschema' + end + + def test_class_zone_offset + raise NotImplementedError, 'Need to write test_class_zone_offset' + end + + # Instance Methods: + + def test__dump + raise NotImplementedError, 'Need to write test__dump' end *************** *** 184,188 **** end ! def test_eql? t1=Time.now t2=t1 --- 275,283 ---- end ! def test_dst_eh ! raise NotImplementedError, 'Need to write test_dst_eh' ! end ! ! def test_eql_eh t1=Time.now t2=t1 *************** *** 193,197 **** end ! def test_gmt? assert(!Time.now.gmt?) assert(Time.now.gmtime.gmt?) --- 288,304 ---- end ! def test_getgm ! raise NotImplementedError, 'Need to write test_getgm' ! end ! ! def test_getlocal ! raise NotImplementedError, 'Need to write test_getlocal' ! end ! ! def test_getutc ! raise NotImplementedError, 'Need to write test_getutc' ! end ! ! def test_gmt_eh assert(!Time.now.gmt?) assert(Time.now.gmtime.gmt?) *************** *** 200,203 **** --- 307,314 ---- end + def test_gmt_offset + raise NotImplementedError, 'Need to write test_gmt_offset' + end + def test_gmtime t = Time.now *************** *** 209,212 **** --- 320,327 ---- end + def test_gmtoff + raise NotImplementedError, 'Need to write test_gmtoff' + end + def test_hash t = Time.now *************** *** 214,219 **** sleep(0.1) t3 = Time.now ! assert(t.hash == t2.hash) ! assert(t.hash != t3.hash) end --- 329,334 ---- sleep(0.1) t3 = Time.now ! assert_equal(t.hash, t2.hash) ! assert_not_equal(t.hash, t3.hash) end *************** *** 222,225 **** --- 337,356 ---- end + def test_httpdate + raise NotImplementedError, 'Need to write test_httpdate' + end + + def test_initialize + t1 = Time.new + sleep 1 + t2 = Time.new + d = t2.to_f - t1.to_f + assert(d > 0.9 && d < 1.1) + end + + def test_inspect + raise NotImplementedError, 'Need to write test_inspect' + end + def test_isdst # This code is problematic: how do I find out the exact *************** *** 240,244 **** dtest = [ ! [false, 2000, 1, 1], [true, 2000, 7, 1], ] --- 371,375 ---- dtest = [ ! [false, 2000, 1, 1], [true, 2000, 7, 1], ] *************** *** 263,266 **** --- 394,401 ---- end + def test_iso8601 + raise NotImplementedError, 'Need to write test_iso8601' + end + def test_localtime t = Time.now.gmtime *************** *** 280,283 **** --- 415,429 ---- end + def test_minus # '-' + @@dates.each do |x| + # Check subtracting an amount in seconds + assert_equal(Time.local(*x.result) - x.amt, Time.local(*x.orig)) + assert_equal(Time.gm(*x.result) - x.amt, Time.gm(*x.orig)) + # Check subtracting two times + assert_equal(Time.local(*x.result) - Time.local(*x.orig), x.amt) + assert_equal(Time.gm(*x.result) - Time.gm(*x.orig), x.amt) + end + end + def test_mon checkComponent(:mon, 1) *************** *** 288,295 **** --- 434,474 ---- end + def test_plus # '+' + @@dates.each do |x| + assert_equal(Time.local(*x.orig) + x.amt, Time.local(*x.result)) + assert_equal(Time.gm(*x.orig) + x.amt, Time.gm(*x.result)) + end + end + + def test_rfc2822 + raise NotImplementedError, 'Need to write test_rfc2822' + end + + def test_rfc822 + raise NotImplementedError, 'Need to write test_rfc822' + end + def test_sec checkComponent(:sec, 5) end + def test_spaceship # '<=>' + @@dates.each do |x| + if (x.amt != 0) + assert_equal(1, Time.local(*x.result) <=> Time.local(*x.orig), + "#{x.result} should be > #{x.orig}") + + assert_equal(-1, Time.local(*x.orig) <=> Time.local(*x.result)) + assert_equal(0, Time.local(*x.orig) <=> Time.local(*x.orig)) + assert_equal(0, Time.local(*x.result) <=> Time.local(*x.result)) + + assert_equal(1,Time.gm(*x.result) <=> Time.gm(*x.orig)) + assert_equal(-1,Time.gm(*x.orig) <=> Time.gm(*x.result)) + assert_equal(0,Time.gm(*x.orig) <=> Time.gm(*x.orig)) + assert_equal(0,Time.gm(*x.result) <=> Time.gm(*x.result)) + end + end + end + def test_strftime # Sat Jan 1 14:58:42 2000 *************** *** 327,330 **** --- 506,513 ---- end + def test_succ + raise NotImplementedError, 'Need to write test_succ' + end + def test_to_a t = Time.now *************** *** 355,358 **** --- 538,542 ---- def test_to_s + flunk "You can't use strftime to test to_s!" t = Time.now assert_equal(t.strftime("%a %b %d %H:%M:%S %Z %Y"),t.to_s) *************** *** 376,379 **** --- 560,575 ---- end + def test_utc + raise NotImplementedError, 'Need to write test_utc' + end + + def test_utc_eh + raise NotImplementedError, 'Need to write test_utc_eh' + end + + def test_utc_offset + raise NotImplementedError, 'Need to write test_utc_offset' + end + def test_wday t = Time.local(2001, 4, 1) *************** *** 385,388 **** --- 581,588 ---- end + def test_xmlschema + raise NotImplementedError, 'Need to write test_xmlschema' + end + def test_yday t = Time.local(2001, 1, 1) *************** *** 407,510 **** end - def test_s__load - end - - def test_s_at - t = Time.now - sec = t.to_i - assert_equal(0, Time.at(0).to_i) - assert_equal(t, Time.at(t)) - assert((Time.at(sec,1000000).to_f - Time.at(sec).to_f) == 1.0) - end - - def test_s_gm - assert_raises(ArgumentError) { Time.gm } - assert(Time.gm(2000) != Time.local(2000)) - assert_equal(Time.gm(2000), Time.gm(2000,1,1,0,0,0)) - assert_equal(Time.gm(2000,nil,nil,nil,nil,nil), Time.gm(2000,1,1,0,0,0)) - assert_raises(ArgumentError) { Time.gm(2000,0) } - assert_raises(ArgumentError) { Time.gm(2000,13) } - assert_raises(ArgumentError) { Time.gm(2000,1,1,24) } - Time.gm(2000,1,1,23) - @@months.each do |month, num| - assert_equal(Time.gm(2000,month), Time.gm(2000,num,1,0,0,0)) - assert_equal(Time.gm(1970,month), Time.gm(1970,num,1,0,0,0)) - assert_equal(Time.gm(2037,month), Time.gm(2037,num,1,0,0,0)) - end - t = Time.gm(2000,1,1) - a = t.to_a - assert_equal(Time.gm(*a),t) - end - - def test_s_local - assert_raises(ArgumentError) { Time.local } - assert(Time.gm(2000) != Time.local(2000)) - assert_equal(Time.local(2000), Time.local(2000,1,1,0,0,0)) - assert_equal(Time.local(2000,nil,nil,nil,nil,nil), Time.local(2000,1,1,0,0,0)) - assert_raises(ArgumentError) { Time.local(2000,0) } - assert_raises(ArgumentError) { Time.local(2000,13) } - assert_raises(ArgumentError) { Time.local(2000,1,1,24) } - Time.local(2000,1,1,23) - @@months.each do |month, num| - assert_equal(Time.local(2000,month), Time.local(2000,num,1,0,0,0)) - assert_equal(Time.local(1971,month), Time.local(1971,num,1,0,0,0)) - assert_equal(Time.local(2037,month), Time.local(2037,num,1,0,0,0)) - end - t = Time.local(2000,1,1) - a = t.to_a - assert_equal(Time.local(*a),t) - end - - def test_s_mktime - # - # Test insufficient arguments - # - assert_raises(ArgumentError) { Time.mktime } - assert(Time.gm(2000) != Time.mktime(2000)) - assert_equal(Time.mktime(2000), Time.mktime(2000,1,1,0,0,0)) - assert_equal(Time.mktime(2000,nil,nil,nil,nil,nil), Time.mktime(2000,1,1,0,0,0)) - assert_raises(ArgumentError) { Time.mktime(2000,0) } - assert_raises(ArgumentError) { Time.mktime(2000,13) } - assert_raises(ArgumentError) { Time.mktime(2000,1,1,24) } - Time.mktime(2000,1,1,23) - - # - # Make sure spelled-out month names work - # - @@months.each do |month, num| - assert_equal(Time.mktime(2000,month), Time.mktime(2000,num,1,0,0,0)) - assert_equal(Time.mktime(1971,month), Time.mktime(1971,num,1,0,0,0)) - assert_equal(Time.mktime(2037,month), Time.mktime(2037,num,1,0,0,0)) - end - t = Time.mktime(2000,1,1) - a = t.to_a - assert_equal(Time.mktime(*a),t) - end - - def test_s_new - t1 = Time.new - sleep 1 - t2 = Time.new - d = t2.to_f - t1.to_f - assert(d > 0.9 && d < 1.1) - end - - def test_s_now - t1 = Time.now - sleep 1 - t2 = Time.now - d = t2.to_f - t1.to_f - assert(d > 0.9 && d < 1.1) - end - - def test_s_times - Version.less_than("1.7") do - assert_instance_of(Struct::Tms, Time.times) - end - Version.greater_or_equal("1.7") do - assert_instance_of(Struct::Tms, Process.times) - end - end - end --- 607,610 ---- From zenspider at rubyforge.org Wed Mar 23 20:00:05 2005 From: zenspider at rubyforge.org (zenspider@rubyforge.org) Date: Wed Mar 23 20:00:06 2005 Subject: [Rubytests-commit] rubicon/builtin TestTime.rb Message-ID: <200503240100.j2O105dS032557@rubyforge.org> Update of /var/cvs/rubytests/rubicon/builtin In directory rubyforge.org:/tmp/cvs-serv32506 Modified Files: TestTime.rb Log Message: Fixed test error in test_isdst Index: TestTime.rb =================================================================== RCS file: /var/cvs/rubytests/rubicon/builtin/TestTime.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TestTime.rb 24 Mar 2005 00:54:17 -0000 1.6 --- TestTime.rb 24 Mar 2005 01:00:03 -0000 1.7 *************** *** 380,384 **** [false, 2000, 4,2,1,59], # Spring forward [true, 2000, 4,2,3,0], ! [true, 2000, 10,29,1,59], # Fall back [false, 2000, 10,29,2,0] ) --- 380,384 ---- [false, 2000, 4,2,1,59], # Spring forward [true, 2000, 4,2,3,0], ! [true, 2000, 10,29,0,59], # Fall back [false, 2000, 10,29,2,0] ) From holmberg at rubyforge.org Wed Mar 30 19:25:19 2005 From: holmberg at rubyforge.org (holmberg@rubyforge.org) Date: Wed Mar 30 19:25:21 2005 Subject: [Rubytests-commit] rubicon AllTests.rb rubicon_tests.rb Message-ID: <200503310025.j2V0PJdS006006@rubyforge.org> Update of /var/cvs/rubytests/rubicon In directory rubyforge.org:/tmp/cvs-serv5965 Modified Files: AllTests.rb rubicon_tests.rb Log Message: Added a simple option processing, used to recognize the newly introduced -m and -M options. Also made the option processing accept (and ignore) a -n option. This accomplishes the same as an earlier change, but is more specific than the previous change (that use catch(:invalid_test)). Index: rubicon_tests.rb =================================================================== RCS file: /var/cvs/rubytests/rubicon/rubicon_tests.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** rubicon_tests.rb 24 Mar 2005 00:54:06 -0000 1.13 --- rubicon_tests.rb 31 Mar 2005 00:25:17 -0000 1.14 *************** *** 25,36 **** # TestRunner.quiet_mode = true suite=nil ! if ARGV.size == 0 suite = testClass.suite else suite = Test::Unit::TestSuite.new ! ARGV.each do |testmethod| ! catch(:invalid_test) do ! suite << testClass.new(testmethod) ! end end end --- 25,47 ---- # TestRunner.quiet_mode = true suite=nil ! selected_testmethods = [] ! ARGV.each do |arg| ! case arg ! when "-n" ! # ignore "-n" option for compatibility with ! # vanilla Test::Unit::AutoRunner ! when "-m", "-M" ! require "rubicon_missing" ! $rubicon_missing_strict = (arg == "-M") ! else ! selected_testmethods << arg ! end ! end ! if selected_testmethods.size == 0 suite = testClass.suite else suite = Test::Unit::TestSuite.new ! selected_testmethods.each do |testmethod| ! suite << testClass.new(testmethod) end end Index: AllTests.rb =================================================================== RCS file: /var/cvs/rubytests/rubicon/AllTests.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AllTests.rb 13 Feb 2004 20:26:29 -0000 1.2 --- AllTests.rb 31 Mar 2005 00:25:17 -0000 1.3 *************** *** 18,28 **** tests = Rubicon::BulkTestRunner.new(ARGV, "All Tests") # and tell it what files to test ! if ARGV.size.zero? for dir in SUB_DIRS Dir[File.join(base, dir, "Test*.rb")].each { |file| tests.addFile(file) } end else ! ARGV.each { |file| tests.addFile(file) } end --- 18,39 ---- tests = Rubicon::BulkTestRunner.new(ARGV, "All Tests") + selected_files = [] + ARGV.each do |arg| + case arg + when "-m", "-M" + require "rubicon_missing" + $rubicon_missing_strict = (arg == "-M") + else + selected_files << arg + end + end + # and tell it what files to test ! if selected_files.size.zero? for dir in SUB_DIRS Dir[File.join(base, dir, "Test*.rb")].each { |file| tests.addFile(file) } end else ! selected_files.each { |file| tests.addFile(file) } end From holmberg at rubyforge.org Wed Mar 30 19:27:27 2005 From: holmberg at rubyforge.org (holmberg@rubyforge.org) Date: Wed Mar 30 19:27:27 2005 Subject: [Rubytests-commit] rubicon rubicon_missing.rb Message-ID: <200503310027.j2V0RRdS006056@rubyforge.org> Update of /var/cvs/rubytests/rubicon In directory rubyforge.org:/tmp/cvs-serv6039 Added Files: rubicon_missing.rb Log Message: Tests of "missing test methods" and "test methods for non-existing methods". Activated by the -m or -M option. --- NEW FILE: rubicon_missing.rb --- # # An "addon" to the Rubicon testsuite to test for "missing" tests of # a class/module under test. # # Rubicon::MethodChecker is used as a "namespace" to avoid cluttering # the Rubicon::TestCase class. It is used from that class (see below). class Rubicon::MethodChecker @@alias_to_op = { "PLUS" => '+', "MINUS" => '-', "UPLUS" => "+@", "UMINUS" => "-@", "MUL" => '*', "DIV" => "/", "MOD" => "%", "POW" => "**", "AND" => '&', "OR" => '|', "XOR" => '^', "REV" => "~", "LSHIFT" => '<<', "RSHIFT" => ">>", "CMP" => '<=>', "EQUAL" => '==', "VERY_EQUAL" => '===', "AREF" => '[]', "ASET" => '[]=', "LT" => '<', "LE" => '<=', "GT" => '>', "GE" => '>=', "MATCH" => '=~', "BACKTICK" => '`', } @@op_to_alias = @@alias_to_op.invert def initialize(test_obj) @test_obj = test_obj end def methods_to_test(inherited=false) names = tested_class.public_instance_methods(inherited) instance_display_names(names) end def singleton_methods_to_test #names = tested_class.public_methods(false) names = tested_class.singleton_methods(false) singleton_display_names(names) end def tested_methods names = test_class.public_instance_methods(false).select do |m| m =~ /^test_[a-zA-Z]/ && m !~ /^test_s_/ end.map do |m| m.sub(/^test_/, "") end.map do |m| @@alias_to_op[m] || m end instance_display_names(names) end def tested_singleton_methods names = test_class.public_instance_methods(false).select do |m| m =~ /^test_s_[a-zA-Z]/ end.map do |m| m.sub(/^test_s_/, "") end.map do |m| @@alias_to_op[m] || m end singleton_display_names(names) end def display_names(prefix, names) names.map do |name| if @@op_to_alias[name] prefix + @@op_to_alias[name] + " ( operator " + name + " )" else #if name !~ /^[a-zA-Z0-9_]+([?!=])?$/ # $stderr.puts "strange method: #{name}" # exit!(1) #end prefix + name end end end def instance_display_names(names) display_names("test_", names) end def singleton_display_names(names) display_names("test_s_", names) end def test_class case @test_obj.class.name when "TestArray" ; ArrayBase when "TestHash" ; HashBase when "TestString" ; StringBase else @test_obj.class end end def tested_class klass = @test_obj.class Object.const_get(klass.to_s.sub(/^Test/, '')) end def class_defined? klass = @test_obj.class if klass == Rubicon::TestCase false else Object.const_defined?(klass.to_s.sub(/^Test/, '')) end end end #---------------------------------------------------------------------- class Rubicon::TestCase def test_95_untested_methods checker = Rubicon::MethodChecker.new(self) return unless checker.class_defined? assert_equal([], checker.methods_to_test - checker.tested_methods, "Missing tests in #{checker.test_class}") end def test_96_untested_class_methods checker = Rubicon::MethodChecker.new(self) return unless checker.class_defined? assert_equal([], checker.singleton_methods_to_test - checker.tested_singleton_methods, "Missing tests in #{checker.test_class} (for singletons)") end def test_97_unknown_methods_tested checker = Rubicon::MethodChecker.new(self) return unless checker.class_defined? assert_equal([], checker.tested_methods - checker.methods_to_test(! $rubicon_missing_strict), "Unknown tests in #{checker.test_class}") end def test_98_unknown_class_methods_tested checker = Rubicon::MethodChecker.new(self) return unless checker.class_defined? assert_equal([], checker.tested_singleton_methods - checker.singleton_methods_to_test, "Unknown tests in #{checker.test_class} (for singletons)") end end