mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_parser_events.rb: event token
* test/ripper/test_parser_events.rb (test_opassign): test parsed event tokens too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
00ce700c93
commit
edc87841f2
1 changed files with 40 additions and 27 deletions
|
@ -738,44 +738,57 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
|
|||
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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 **= b', :on_opassign) {thru_opassign = true}
|
||||
assert_equal true, thru_opassign
|
||||
thru_opassign = false
|
||||
parse('a &= b', :on_opassign) {thru_opassign = true}
|
||||
assert_equal true, thru_opassign
|
||||
thru_opassign = false
|
||||
parse('a |= b', :on_opassign) {thru_opassign = true}
|
||||
assert_equal true, thru_opassign
|
||||
thru_opassign = false
|
||||
parse('a <<= b', :on_opassign) {thru_opassign = true}
|
||||
assert_equal true, thru_opassign
|
||||
thru_opassign = false
|
||||
parse('a >>= b', :on_opassign) {thru_opassign = true}
|
||||
assert_equal true, thru_opassign
|
||||
thru_opassign = false
|
||||
parse('a &&= b', :on_opassign) {thru_opassign = true}
|
||||
assert_equal true, thru_opassign
|
||||
thru_opassign = false
|
||||
parse('a ||= b', :on_opassign) {thru_opassign = true}
|
||||
assert_equal true, thru_opassign
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue