summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-04-23 13:14:27 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-13 18:44:32 +0900
commitf169043d81524b5b529f2c1e9c35437ba5bc3a7a (patch)
treecaa8e094163afc9d2d177cc0d151a8b906704aee /test
parente717d6faa8463c70407e6aaf116c6b6181f30be6 (diff)
Add pipeline operator [Feature #15799]
Diffstat (limited to 'test')
-rw-r--r--test/ripper/test_scanner_events.rb2
-rw-r--r--test/ruby/test_syntax.rb7
2 files changed, 9 insertions, 0 deletions
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb
index 339a66d5ec..323c4098e8 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -573,6 +573,8 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
scan('op', 'obj.:foo')
assert_equal [],
scan('op', %q[`make all`])
+ assert_equal %w[|>],
+ scan('op', %q[x|>y])
end
def test_symbeg
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index f2fcf671aa..7bffb8790b 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1379,6 +1379,13 @@ eom
assert_syntax_error('@1', /outside block/)
end
+ def test_pipeline_operator
+ assert_valid_syntax('x |> y')
+ x = nil
+ assert_equal("121", eval('x = 12 |> pow(2) |> to_s(11)'))
+ assert_equal(12, x)
+ end
+
private
def not_label(x) @result = x; @not_label ||= nil end