diff options
Diffstat (limited to 'test/scanf/test_scanfio.rb')
-rw-r--r-- | test/scanf/test_scanfio.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/test/scanf/test_scanfio.rb b/test/scanf/test_scanfio.rb index 65989877d6..c8740aed43 100644 --- a/test/scanf/test_scanfio.rb +++ b/test/scanf/test_scanfio.rb @@ -5,11 +5,15 @@ # Ad hoc tests of IO#scanf (needs to be expanded) -$:.unshift("..") -require "scanf.rb" - -fh = File.new("data.txt", "r") -p fh.pos -p fh.scanf("%s%s") -p fh.scanf("%da fun%s") -p fh.pos +require "scanf" + +class TestScanfIO + def test_io + fh = File.new(File.join(File.dirname(__FILE__), "data.txt"), "r") + assert_equal(0, fh.pos) + assert_equal(["this", "is"], fh.scanf("%s%s")) + assert_equal([33, "littel"], fh.scanf("%da fun%s")) + #p fh.pos + end +end + |