aboutsummaryrefslogtreecommitdiffstats
path: root/test/ripper
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-02 14:13:20 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-02 14:13:20 +0000
commit856a9afb98b8443a8b32483a97e271560af6de1b (patch)
tree90ff80ad3c87ea3fcab24f81b5b84b6832c3e5ca /test/ripper
parentba95b9787d941aeda329bba6427f7533b89ad2b7 (diff)
downloadruby-856a9afb98b8443a8b32483a97e271560af6de1b.tar.gz
eventids2.c: new literals
* ext/ripper/eventids2.c (ripper_init_eventids2): ripper support for new literals, tRATIONAL and tIMAGINARY. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper')
-rw-r--r--test/ripper/test_scanner_events.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb
index a96edef063..2474588f76 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -87,6 +87,17 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
[[1, 1], :on_tstring_content, "\u3042\n\u3044"],
[[2, 3], :on_tstring_end, "'"]],
Ripper.lex("'\u3042\n\u3044'")
+ assert_equal [[[1, 0], :on_rational, "1r"],
+ [[1, 2], :on_nl, "\n"],
+ [[2, 0], :on_imaginary, "2i"],
+ [[2, 2], :on_nl, "\n"],
+ [[3, 0], :on_imaginary, "3ri"],
+ [[3, 3], :on_nl, "\n"],
+ [[4, 0], :on_rational, "4.2r"],
+ [[4, 4], :on_nl, "\n"],
+ [[5, 0], :on_imaginary, "5.6ri"],
+ ],
+ Ripper.lex("1r\n2i\n3ri\n4.2r\n5.6ri")
end
def test_location
@@ -264,6 +275,13 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
scan('float', 'm(a,b,1.0,c,d)')
end
+ def test_rational
+ assert_equal [],
+ scan('rational', '')
+ assert_equal ['1r', '10r', '10.1r'],
+ scan('rational', 'm(1r,10r,10.1r)')
+ end
+
def test_gvar
assert_equal [],
scan('gvar', '')
@@ -286,6 +304,13 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
scan('ident', 'm(lvar, @ivar, @@cvar, $gvar)')
end
+ def test_imaginary
+ assert_equal [],
+ scan('imaginary', '')
+ assert_equal ['1i', '10ri', '10.0i', '10.1ri'],
+ scan('imaginary', 'm(1i,10ri,10.0i,10.1ri)')
+ end
+
def test_int
assert_equal [],
scan('int', '')