C
Christer Nilsson
I would like to be able to display the line number in my simple assert.
1 def assert(expect, actual, *msg)
2 expect==actual ? print(".") : print("\nAssert at line #{__LINE__}
failed: #{expect.inspect} <> #{actual.inspect} #{msg}\n")
3 end
4
5 assert 1, 2
6 assert 1, 1
The solution above erroneously displays line 2 instead of line 5.
Christer
1 def assert(expect, actual, *msg)
2 expect==actual ? print(".") : print("\nAssert at line #{__LINE__}
failed: #{expect.inspect} <> #{actual.inspect} #{msg}\n")
3 end
4
5 assert 1, 2
6 assert 1, 1
The solution above erroneously displays line 2 instead of line 5.
Christer