Skip to content

Commit

Permalink
Add code to Test.rb to permit todo/skip to note the issue number that…
Browse files Browse the repository at this point in the history
… the problem is associated with. Also update the tests to take advantage of it.
  • Loading branch information
treed committed Jul 25, 2009
1 parent 77d6f8e commit 0b92deb
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 44 deletions.
12 changes: 6 additions & 6 deletions Test.rb
Expand Up @@ -51,17 +51,17 @@ def isnt(got,expected,desc='')
proclaim(got != expected, desc)
end

def todo(reason,count=1)
def todo(reason,issue="",count=1)
$todo_upto = $testnum + count
$todo_reason = '# TODO ' + reason
$todo_reason = " # TODO #{reason} See issue ##{issue}."
end

def skip(reason='',count=1)
1.upto(count) { flunk('# SKIP ' + reason) }
def skip(reason='',issue="",count=1)
1.upto(count) { flunk("# SKIP #{reason} See issue ##{issue}.") }
end

def skip_rest(reason='')
skip(reason,$planned - $testnum + 1)
def skip_rest(reason='',issue="")
skip(reason,issue,$planned - $testnum + 1)
end

def proclaim(cond,desc)
Expand Down
2 changes: 1 addition & 1 deletion t/07-loops.t
Expand Up @@ -10,7 +10,7 @@ end

a = [ 5, 6, 7, 8 ]

skip("for x in y doesn't work", 8)
skip "for x in y doesn't work", "2", 8
#for i in a
# ok(i < 9, 'for loop')
#end
Expand Down
2 changes: 1 addition & 1 deletion t/11-slurpy.t
Expand Up @@ -3,7 +3,7 @@ include Test
plan 4

def foo(*n)
todo "Slurpy param is apparently not an array."
todo "Slurpy param is apparently not an array.", "3"
is n.WHAT, Array, "slurpy param is an array"
i = 0
n.each do |a|
Expand Down
2 changes: 1 addition & 1 deletion t/alias.t
Expand Up @@ -19,5 +19,5 @@ end

obj = NumberHolder.new(0)
is obj.inc, 1, '.alias method'
skip("aliased methods don't seem to work")
skip "aliased methods don't seem to work", "4"
#is obj.increment, 2, '.alias method'
2 changes: 1 addition & 1 deletion t/array/fill.t
Expand Up @@ -6,7 +6,7 @@ a = Array.new(2)

is a, [ nil, nil ], '.new on Array'

todo "Array.fill", 3
todo "Array.fill", "5", 3
#a = a.fill('-')
is a, [ '-', '-' ], '.fill on Array'

Expand Down
2 changes: 1 addition & 1 deletion t/assignment.t
Expand Up @@ -7,7 +7,7 @@ is a, 1, 'single assignment per line'
a = 2
is a, 2, 'single assignment per line'

todo("Multiple assignment is broken", 6)
todo("Multiple assignment is broken", "6", 6)
#x, y, z = 3, 4, 5
is x, 3, 'multiple assignment per line'
is y, 4, 'multiple assignment per line'
Expand Down
2 changes: 1 addition & 1 deletion t/file/dir.t
Expand Up @@ -7,7 +7,7 @@ d = Dir.new('.')
files = Dir.entries('.')
if files.include?('tmp')
pass '.entries on Dir'
skip ".mkdir on Dir, tmp dir already exists"
nok ".mkdir on Dir, tmp dir already exists"
else
Dir.mkdir('./tmp')
pass '.mkdir on Dir'
Expand Down
2 changes: 1 addition & 1 deletion t/file/file.t
Expand Up @@ -2,7 +2,7 @@ require 'Test'
include Test
plan 12

skip_rest "Class methods of File fail because File can't be found OSLT"
skip_rest "Class methods of File fail because File can't be found OSLT", "24"

#def cleanup(name)
# if File.exist?(name)
Expand Down
2 changes: 1 addition & 1 deletion t/file/stat.t
@@ -1,7 +1,7 @@
require 'Test'
include Test
plan 20
skip_rest "Fails because File can't be found OSLT."
skip_rest "Fails because File can't be found OSLT.", "24"
# need a better test for these things. this shows that we at least can parse and execute these commands
#name = "file-stat-tmp.txt"
#f = File.new(name, "w")
Expand Down
2 changes: 1 addition & 1 deletion t/freeze.t
Expand Up @@ -19,5 +19,5 @@ end
obj = NumberHolder.new(0)
obj.inc
obj.freeze
todo "Fix .freeze method"
todo "Fix .freeze method", "7"
isnt obj.inc, 2, '.freeze method'
3 changes: 1 addition & 2 deletions t/hash/hash.t
Expand Up @@ -15,10 +15,9 @@ is b[a['a']], 2, "basic hash access"

#c = Hash.new('ok')

skip("Complete failure, goes into double free loop when I try to trace.")
skip "Complete failure, goes into double free loop when I try to trace.", "8", 2
#is c['a'], 'ok', "hash static default"

skip("same")
#d = Hash.new() { |hash, key| pass "hash block default"; hash[key] = 5 }

#is d['foo'], 5, "hash block default"
16 changes: 8 additions & 8 deletions t/integer/integer.t
Expand Up @@ -23,42 +23,42 @@ end

int1 = 300
int2 = -300
todo "Integers being autoconverted to string for comparison?", 2
todo "Integers being autoconverted to string for comparison?", "9", 2
test_by_int int1, int2, 'assignment of an Integer'

str1 = int1.to_s
str2 = int2.to_s
todo "Integers being autoconverted to string for comparison?", 2
todo "Integers being autoconverted to string for comparison?", "9", 2
test_by_str str1, str2, '.to_s on Integer'

test1 = int1.to_i
test2 = int2.to_i
todo "Integers being autoconverted to string for comparison?", 2
todo "Integers being autoconverted to string for comparison?", "9", 2
test_by_int test1, test2, '.to_i on Integer'

test1 = int1.to_int
test2 = int2.to_int
todo "Integers being autoconverted to string for comparison?", 2
todo "Integers being autoconverted to string for comparison?", "9", 2
test_by_int test1, test2, '.to_int on Integer'

test1 = int1.floor
test2 = int2.floor
todo "Integers being autoconverted to string for comparison?", 2
todo "Integers being autoconverted to string for comparison?", "9", 2
test_by_int test1, test2, '.floor on Integer'

test1 = int1.ceil
test2 = int2.ceil
todo "Integers being autoconverted to string for comparison?", 2
todo "Integers being autoconverted to string for comparison?", "9", 2
test_by_int test1, test2, '.ceil on Integer'

test1 = int1.round
test2 = int2.round
todo "Integers being autoconverted to string for comparison?", 2
todo "Integers being autoconverted to string for comparison?", "9", 2
test_by_int test1, test2, '.round on Integer'

test1 = int1.truncate
test2 = int2.truncate
todo "Integers being autoconverted to string for comparison?", 2
todo "Integers being autoconverted to string for comparison?", "9", 2
test_by_int test1, test2, '.truncate on Integer'

test1 = int1.succ
Expand Down
2 changes: 1 addition & 1 deletion t/kernel/open.t
Expand Up @@ -2,7 +2,7 @@ require 'Test'
include Test
plan 2

skip_rest "open() doesn't seem to exist"
skip_rest "open() doesn't seem to exist", "25"
#pipe = open("| echo *.t")
#p pipe.class
#files = pipe.readline
Expand Down
10 changes: 5 additions & 5 deletions t/proc.t
Expand Up @@ -6,13 +6,13 @@ proc = Proc.new{ |n|
is n, 1, '.call on Proc'
}
pass '.new on Proc'
todo ".class of Proc is not Proc, apparently"
todo ".class of Proc is not Proc, apparently", "10"
is proc.class.to_s, 'Proc', '.class on Proc'
todo "Proc.arity is broken"
todo "Proc.arity is broken", "11"
is proc.arity, 1, '.arity on Proc'
proc.call(1)
myself = proc.to_proc
todo "Proc.to_proc is broken."
todo "Proc.to_proc is broken.", "12"
is myself.class.to_s, 'Proc', '.to_proc on Proc'

def gen_times(factor)
Expand All @@ -22,8 +22,8 @@ end
times3 = gen_times(3)
times5 = gen_times(5)

todo "Problem with Proc.call?"
todo "Problem with Proc.call?", "13"
is times3.call(12), 36, '.call on Proc'
is times5.call(5), 25, '.call on Proc'
todo "Problem with Proc.call?"
todo "Problem with Proc.call?", "13"
is times3.call(times5.call(4)), 60, '.call on Proc'
8 changes: 4 additions & 4 deletions t/range.t
Expand Up @@ -3,19 +3,19 @@ include Test
plan 9

discrete = 1..4
todo ".class of Range is not Range."
todo ".class of Range is not Range.", "10"
is discrete.class.to_s, 'Range', 'simple discrete Range creation'

r = 5..6
proclaim r.include?(5), '.include? for Range'
nok r.include?(100), '.include? for Range'
proclaim r.member?(6), '.member? for Range'

skip("Parens around a range are for some reason unparseable.")
skip("Parens around a range are for some reason unparseable.", "15")
#arr = (7..9).to_a
#is arr, [7, 8, 9], 'to_a for Range'

skip("Something unparseable here.",3)
skip("Something unparseable here.","15",3)
#prev = 1
#2...4.each do |cur|
# if(cur == (prev + 1))
Expand All @@ -24,7 +24,7 @@ skip("Something unparseable here.",3)
# prev = cur
#end

skip("Something else broken with parsing here, too.")
skip("Something else broken with parsing here, too.", "15")
#find_me = 1337
#rule = case find_me
# when 0..400
Expand Down
6 changes: 3 additions & 3 deletions t/splat.t
Expand Up @@ -27,9 +27,9 @@ returned = splat(8)
is returned , 8, 'splat'

b = [11, 10, 9]
skip("Splat syntax doesn't parse.",2)
skip "Splat syntax doesn't parse.", "16", 2
#returned = splat(*b)
todo "Splat syntax is broken?"
todo "Splat syntax is broken?", "16"
is returned, 11, 'splat'

returned = splat(b)
Expand All @@ -43,7 +43,7 @@ def dec_three_ary(start)
a
end
skip("Splat syntax doesn't parse.", 2)
skip("Splat syntax doesn't parse.", "16", 2)
#returned = splat(*dec_three_ary(15))
todo "Splat syntax is broken?"
is returned, 15, 'splat'
Expand Down
6 changes: 3 additions & 3 deletions t/string/block.t
Expand Up @@ -8,7 +8,7 @@ is s.size, 4, '.size for String'
s = 'ruby'
ruby = "____"
i = 0
skip('String.each_byte stopped working. See issue #22')
skip 'String.each_byte stopped working.', "22"
#s.each_byte() do |c|
# ruby[i] = c
# i = i + 1
Expand All @@ -18,11 +18,11 @@ parrot = 'parrot'
i = 0
parrot.each('r') do |split|
if i == 0
todo "Fix String.each(char)"
todo "Fix String.each(char)", "17"
is split, 'par', '.each(char) for String'
end
if i == 1
todo "Fix String.each(char)"
todo "Fix String.each(char)", "17"
is split, 'r', '.each(char) for String'
end
if i == 2
Expand Down
2 changes: 1 addition & 1 deletion t/string/reverse.t
Expand Up @@ -2,7 +2,7 @@ require 'Test'
include Test
plan 2

todo("String.reverse is kinda broken. See issue #22.",2)
todo "String.reverse is kinda broken.","22",2
s1 = "testset!"
#s2 = s1.reverse
is s2, '!testset', '.reverse for String'
Expand Down
4 changes: 2 additions & 2 deletions t/time.t
Expand Up @@ -21,7 +21,7 @@ if !t.gmt?
epoch1 = t.to_i
t.gmtime
epoch2 = t.to_i
todo "Fix gmtime"
todo "Fix gmtime", "18"
isnt epoch1, epoch2, '.gmtime on Time when not gmt'
else
pass '.gmt? on Time when gmt'
Expand All @@ -43,6 +43,6 @@ proclaim sec < sec2, 'sleep'
t2_epoch = Time.new.to_i
isgt t2_epoch, t1_epoch, '.to_i on Time'

todo 'fix Floats in Cardinal'
todo 'fix Floats in Cardinal', "19"
class_name = sprintf("%s", t.to_f.class)
is class_name, 'Float', '.to_f on Time'

0 comments on commit 0b92deb

Please sign in to comment.