Unit testing: example p. 156 pickaxe2

How do you make this example fail:

require “test/unit”

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:

1 tests, 1 assertions, 1 failures, 0 errors

Anyone?

7stud – wrote:

How do you make this example fail:

require “test/unit”

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.