class TestsWhichFail < Test::Unit::TestCase
def test_reading
assert_not_nil(ARGF.read, “Read next line of input”)
end
end
I tried specifying an empty file on the command line, no file, a file
with two words in it, and a file that doesn’t exist, but I can’t get it
to fail. Yet, the output in the book shows:
class TestsWhichFail < Test::Unit::TestCase
def test_reading
assert_not_nil(ARGF.read, “Read next line of input”)
end
end
If I add this line:
ARGF.read #<—***
assert_not_nil(ARGF.read, “Read next line of input”)
and I specify a data file name on the command line, then the test fails.
Curiously, if I omit specifying a data file name on the command line,
and I type ^D while the program is running, I can’t get the test to
fail.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.