summaryrefslogtreecommitdiff
path: root/test/ripper/test_ripper.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-08 00:45:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-08 00:45:13 +0000
commit510f0ec86912e31babaadf1f66bf2a82351c1359 (patch)
tree14e907b72d66b685839ee2453b59fdad3967663c /test/ripper/test_ripper.rb
parentd8bcfd2b12cfd0919cd5c42ef546ae259c9b4160 (diff)
parse.y: ripper generic input
* parse.y (ripper_initialize): allow generic input as source, if it has #gets method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/test_ripper.rb')
-rw-r--r--test/ripper/test_ripper.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ripper/test_ripper.rb b/test/ripper/test_ripper.rb
index c2084d8..b99feb7 100644
--- a/test/ripper/test_ripper.rb
+++ b/test/ripper/test_ripper.rb
@@ -117,4 +117,22 @@ end
assert_nothing_raised { Ripper.lex src }
end
+
+ class TestInput < self
+ Input = Struct.new(:lines) do
+ def gets
+ lines.shift
+ end
+ end
+
+ def setup
+ @ripper = Ripper.new(Input.new(["1 + 1"]))
+ end
+
+ def test_invalid_gets
+ ripper = assert_nothing_raised {Ripper.new(Input.new([0]))}
+ assert_raise(TypeError) {ripper.parse}
+ end
+ end
+
end if ripper_test