Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
unit testing: example p. 156 pickaxe2
7stud 7stud
9/29/2007 1:02:00 PM
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
--
Posted via
http://www.ruby-...
.
2 Answers
7stud 7stud
10/1/2007 4:28:00 AM
0
Anyone?
--
Posted via
http://www.ruby-...
.
7stud 7stud
10/1/2007 9:40:00 AM
0
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.
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
unit testing: example p. 156 pickaxe2
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password