[前][次][番号順一覧][スレッド一覧]

ruby-changes:40236

From: nobu <ko1@a...>
Date: Wed, 28 Oct 2015 13:26:35 +0900 (JST)
Subject: [ruby-changes:40236] nobu:r52317 (trunk): test_parser_events.rb: event token

nobu	2015-10-28 13:26:22 +0900 (Wed, 28 Oct 2015)

  New Revision: 52317

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52317

  Log:
    test_parser_events.rb: event token
    
    * test/ripper/test_parser_events.rb (test_opassign): test parsed
      event tokens too.

  Modified files:
    trunk/test/ripper/test_parser_events.rb
Index: test/ripper/test_parser_events.rb
===================================================================
--- test/ripper/test_parser_events.rb	(revision 52316)
+++ test/ripper/test_parser_events.rb	(revision 52317)
@@ -738,44 +738,57 @@ class TestRipper::ParserEvents < Test::U https://github.com/ruby/ruby/blob/trunk/test/ripper/test_parser_events.rb#L738
 
   def test_opassign
     thru_opassign = false
-    parse('a += b', :on_opassign) {thru_opassign = true}
+    tree = parse('a += b', :on_opassign) {thru_opassign = true}
     assert_equal true, thru_opassign
+    assert_equal "[opassign(var_field(a),+=,vcall(b))]", tree
     thru_opassign = false
-    parse('a -= b', :on_opassign) {thru_opassign = true}
+    tree = parse('a -= b', :on_opassign) {thru_opassign = true}
     assert_equal true, thru_opassign
+    assert_equal "[opassign(var_field(a),-=,vcall(b))]", tree
     thru_opassign = false
-    parse('a *= b', :on_opassign) {thru_opassign = true}
+    tree = parse('a *= b', :on_opassign) {thru_opassign = true}
     assert_equal true, thru_opassign
+    assert_equal "[opassign(var_field(a),*=,vcall(b))]", tree
     thru_opassign = false
-    parse('a /= b', :on_opassign) {thru_opassign = true}
+    tree = parse('a /= b', :on_opassign) {thru_opassign = true}
     assert_equal true, thru_opassign
+    assert_equal "[opassign(var_field(a),/=,vcall(b))]", tree
     thru_opassign = false
-    parse('a %= b', :on_opassign) {thru_opassign = true}
+    tree = parse('a %= b', :on_opassign) {thru_opassign = true}
     assert_equal true, thru_opassign
+    assert_equal "[opassign(var_field(a),%=,vcall(b))]", tree
     thru_opassign = false
-    parse('a **= b', :on_opassign) {thru_opassign = true}
+    tree = parse('a **= b', :on_opassign) {thru_opassign = true}
     assert_equal true, thru_opassign
+    assert_equal "[opassign(var_field(a),**=,vcall(b))]", tree
     thru_opassign = false
-    parse('a &= b', :on_opassign) {thru_opassign = true}
+    tree = parse('a &= b', :on_opassign) {thru_opassign = true}
     assert_equal true, thru_opassign
+    assert_equal "[opassign(var_field(a),&=,vcall(b))]", tree
     thru_opassign = false
-    parse('a |= b', :on_opassign) {thru_opassign = true}
+    tree = parse('a |= b', :on_opassign) {thru_opassign = true}
+    assert_equal "[opassign(var_field(a),|=,vcall(b))]", tree
     assert_equal true, thru_opassign
     thru_opassign = false
-    parse('a <<= b', :on_opassign) {thru_opassign = true}
+    tree = parse('a <<= b', :on_opassign) {thru_opassign = true}
     assert_equal true, thru_opassign
+    assert_equal "[opassign(var_field(a),<<=,vcall(b))]", tree
     thru_opassign = false
-    parse('a >>= b', :on_opassign) {thru_opassign = true}
+    tree = parse('a >>= b', :on_opassign) {thru_opassign = true}
     assert_equal true, thru_opassign
+    assert_equal "[opassign(var_field(a),>>=,vcall(b))]", tree
     thru_opassign = false
-    parse('a &&= b', :on_opassign) {thru_opassign = true}
+    tree = parse('a &&= b', :on_opassign) {thru_opassign = true}
     assert_equal true, thru_opassign
+    assert_equal "[opassign(var_field(a),&&=,vcall(b))]", tree
     thru_opassign = false
-    parse('a ||= b', :on_opassign) {thru_opassign = true}
+    tree = parse('a ||= b', :on_opassign) {thru_opassign = true}
     assert_equal true, thru_opassign
+    assert_equal "[opassign(var_field(a),||=,vcall(b))]", tree
     thru_opassign = false
-    parse('a::X ||= c 1', :on_opassign) {thru_opassign = true}
+    tree = parse('a::X ||= c 1', :on_opassign) {thru_opassign = true}
     assert_equal true, thru_opassign
+    assert_equal "[opassign(const_path_field(vcall(a),X),||=,command(c,[1]))]", tree
   end
 
   def test_opassign_error

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]