diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-01-15 19:27:25 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-01-15 19:27:25 -0800 |
commit | 68591a6889c05ff40409429524297d39470921e2 (patch) | |
tree | c2c826c553d8d99b370dde5ddce51178d452ac0a /test | |
parent | 506f5883dfb3cfa0f3e399ef496f491d8ff3ab7a (diff) | |
download | psych-68591a6889c05ff40409429524297d39470921e2.zip |
removing tuples, using static method on scalar scanner
Diffstat (limited to 'test')
-rw-r--r-- | test/test_scalar_scanner.rb | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/test/test_scalar_scanner.rb b/test/test_scalar_scanner.rb index eccb2b4..b05698b 100644 --- a/test/test_scalar_scanner.rb +++ b/test/test_scalar_scanner.rb @@ -9,15 +9,14 @@ class TestScalarScanner < MiniTest::Unit::TestCase '2001-12-15 2:59:43.10', ].each do |time| ss = Psych::ScalarScanner.new time - assert_equal :TIME, ss.tokenize.first + assert_instance_of Time, ss.tokenize end end def test_scan_date date = '1980-12-16' ss = Psych::ScalarScanner.new date - type, token = ss.tokenize - assert_equal :DATE, type + token = ss.tokenize assert_equal 1980, token.year assert_equal 12, token.month assert_equal 16, token.day @@ -25,53 +24,52 @@ class TestScalarScanner < MiniTest::Unit::TestCase def test_scan_inf ss = Psych::ScalarScanner.new('.inf') - assert_equal [:POSITIVE_INFINITY, 1 / 0.0], ss.tokenize + assert_equal 1 / 0.0, ss.tokenize end def test_scan_minus_inf ss = Psych::ScalarScanner.new('-.inf') - assert_equal [:NEGATIVE_INFINITY, -1 / 0.0], ss.tokenize + assert_equal -1 / 0.0, ss.tokenize end def test_scan_nan ss = Psych::ScalarScanner.new('.nan') - assert_equal :NAN, ss.tokenize.first - assert ss.tokenize.last.nan? + assert ss.tokenize.nan? end def test_scan_null ss = Psych::ScalarScanner.new('null') - assert_equal [:NULL, nil], ss.tokenize + assert_equal nil, ss.tokenize ss = Psych::ScalarScanner.new('~') - assert_equal [:NULL, nil], ss.tokenize + assert_equal nil, ss.tokenize ss = Psych::ScalarScanner.new('') - assert_equal [:NULL, nil], ss.tokenize + assert_equal nil, ss.tokenize end def test_scan_symbol ss = Psych::ScalarScanner.new(':foo') - assert_equal [:SYMBOL, :foo], ss.tokenize + assert_equal :foo, ss.tokenize end def test_scan_sexagesimal_float ss = Psych::ScalarScanner.new('190:20:30.15') - assert_equal [:FLOAT, 685230.15], ss.tokenize + assert_equal 685230.15, ss.tokenize end def test_scan_sexagesimal_int ss = Psych::ScalarScanner.new('190:20:30') - assert_equal [:INTEGER, 685230], ss.tokenize + assert_equal 685230, ss.tokenize end def test_scan_float ss = Psych::ScalarScanner.new('1.2') - assert_equal [:FLOAT, 1.2], ss.tokenize + assert_equal 1.2, ss.tokenize end def test_scan_true ss = Psych::ScalarScanner.new('true') - assert_equal [:BOOLEAN, true], ss.tokenize + assert_equal true, ss.tokenize end end |