summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-06 03:39:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-06 03:39:23 +0000
commit837babd56459aafc1232a12fbfa783025d619b98 (patch)
tree72698c46f54d3616d58b62dd2ebb14ec90147a9e /test
parentdfa75017bea479c829db9f967509caa95411361e (diff)
change DOTQ
* defs/id.def (token_ops), parse.y (parser_yylex): change DOTQ from ".?" to "&.". [ruby-core:71363] [Feature #11537] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ripper/test_parser_events.rb14
-rw-r--r--test/ripper/test_scanner_events.rb4
-rw-r--r--test/ruby/test_call.rb22
-rw-r--r--test/ruby/test_iseq.rb2
4 files changed, 21 insertions, 21 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index 9fa65fa89b..fec01f10d2 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -391,14 +391,14 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_equal "[call(vcall(foo),::,call,[])]", tree
thru_call = false
- tree = parse("self.?foo", :on_call) {thru_call = true}
+ tree = parse("self&.foo", :on_call) {thru_call = true}
assert_equal true, thru_call
- assert_equal "[call(ref(self),.?,foo)]", tree
+ assert_equal "[call(ref(self),&.,foo)]", tree
thru_call = false
- tree = parse("self.?foo()", :on_call) {thru_call = true}
+ tree = parse("self&.foo()", :on_call) {thru_call = true}
assert_equal true, thru_call
- assert_equal "[call(ref(self),.?,foo,[])]", tree
+ assert_equal "[call(ref(self),&.,foo,[])]", tree
end
def test_excessed_comma
@@ -569,7 +569,7 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_equal("[defs(vcall(foo),.,bar,[],bodystmt([void()]))]", tree)
thru_parse_error = false
- tree = parse('def foo.?bar; end', :on_parse_error) {thru_parse_error = true}
+ tree = parse('def foo&.bar; end', :on_parse_error) {thru_parse_error = true}
assert_equal(true, thru_parse_error)
end
@@ -796,9 +796,9 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_equal "[opassign(field(ref(self),.,foo),+=,1)]", tree
thru_opassign = false
- tree = parse("self.?foo += 1", :on_opassign) {thru_opassign = true}
+ tree = parse("self&.foo += 1", :on_opassign) {thru_opassign = true}
assert_equal true, thru_opassign
- assert_equal "[opassign(field(ref(self),.?,foo),+=,1)]", tree
+ assert_equal "[opassign(field(ref(self),&.,foo),+=,1)]", tree
end
def test_opassign_error
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb
index 56ba646485..45c16738d0 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -535,8 +535,8 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
scan('op', ':[]')
assert_equal ['[]='],
scan('op', ':[]=')
- assert_equal ['.?'],
- scan('op', 'a.?f')
+ assert_equal ['&.'],
+ scan('op', 'a&.f')
assert_equal [],
scan('op', %q[`make all`])
end
diff --git a/test/ruby/test_call.rb b/test/ruby/test_call.rb
index 12793a7572..2cef0e5c66 100644
--- a/test/ruby/test_call.rb
+++ b/test/ruby/test_call.rb
@@ -35,22 +35,22 @@ class TestCall < Test::Unit::TestCase
def test_safe_call
s = Struct.new(:x, :y, :z)
o = s.new("x")
- assert_equal("X", o.x.?upcase)
- assert_nil(o.y.?upcase)
+ assert_equal("X", o.x&.upcase)
+ assert_nil(o.y&.upcase)
assert_equal("x", o.x)
- o.?x = 6
+ o&.x = 6
assert_equal(6, o.x)
- o.?x *= 7
+ o&.x *= 7
assert_equal(42, o.x)
- o.?y = 5
+ o&.y = 5
assert_equal(5, o.y)
- o.?z ||= 6
+ o&.z ||= 6
assert_equal(6, o.z)
o = nil
- assert_nil(o.?x)
- assert_nothing_raised(NoMethodError) {o.?x = 6}
- assert_nothing_raised(NoMethodError) {o.?x *= 7}
+ assert_nil(o&.x)
+ assert_nothing_raised(NoMethodError) {o&.x = 6}
+ assert_nothing_raised(NoMethodError) {o&.x *= 7}
end
def test_safe_call_evaluate_arguments_only_method_call_is_made
@@ -59,10 +59,10 @@ class TestCall < Test::Unit::TestCase
s = Struct.new(:x, :y)
o = s.new(["a", "b", "c"])
- o.y.?at(proc.call)
+ o.y&.at(proc.call)
assert_equal(0, count)
- o.x.?at(proc.call)
+ o.x&.at(proc.call)
assert_equal(1, count)
end
end
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index f87a8a0361..b8d3c66715 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -181,7 +181,7 @@ class TestISeq < Test::Unit::TestCase
end
def test_safe_call_chain
- src = "a.?a.?a.?a.?a.?a"
+ src = "a&.a&.a&.a&.a&.a"
body = compile(src, __LINE__, {peephole_optimization: true}).to_a[13]
labels = body.select {|op, arg| op == :branchnil}.map {|op, arg| arg}
assert_equal(1, labels.uniq.size)