diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/psych/test_scalar_scanner.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/psych/test_scalar_scanner.rb b/test/psych/test_scalar_scanner.rb index 659909909e..cf0dfff6aa 100644 --- a/test/psych/test_scalar_scanner.rb +++ b/test/psych/test_scalar_scanner.rb @@ -1,4 +1,5 @@ require 'psych/helper' +require 'date' module Psych class TestScalarScanner < TestCase @@ -20,6 +21,27 @@ module Psych end end + def test_scan_bad_dates + x = '2000-15-01' + assert_equal x, @ss.tokenize(x) + + x = '2000-10-51' + assert_equal x, @ss.tokenize(x) + + x = '2000-10-32' + assert_equal x, @ss.tokenize(x) + end + + def test_scan_good_edge_date + x = '2000-1-31' + assert_equal Date.strptime(x, '%Y-%m-%d'), @ss.tokenize(x) + end + + def test_scan_bad_edge_date + x = '2000-11-31' + assert_equal x, @ss.tokenize(x) + end + def test_scan_date date = '1980-12-16' token = @ss.tokenize date |