From: Jean Privat Date: Wed, 19 Nov 2014 02:05:21 +0000 (-0500) Subject: examples/rosettacode: update ab to not crash on tests X-Git-Tag: v0.6.11~24^2~2 X-Git-Url: http://nitlanguage.org examples/rosettacode: update ab to not crash on tests Signed-off-by: Jean Privat --- diff --git a/examples/rosettacode/ab.nit b/examples/rosettacode/ab.nit index 9138c0c..ce18fc0 100644 --- a/examples/rosettacode/ab.nit +++ b/examples/rosettacode/ab.nit @@ -10,4 +10,8 @@ module ab var words = gets.split(" ") +if words.length != 2 then + print "Expected two numbers" + return +end print words[0].to_i + words[1].to_i diff --git a/tests/sav/ab.res b/tests/sav/ab.res index a9dbe22..a5dab0a 100644 --- a/tests/sav/ab.res +++ b/tests/sav/ab.res @@ -1 +1 @@ -Runtime error: Assert 'index' failed (../lib/standard/collection/array.nit:258) +Expected two numbers