aboutsummaryrefslogtreecommitdiffstats
path: root/test/ripper
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
commitd0187bcbc7ed7ecc473ea6f51115b5a317087950 (patch)
tree14e907b72d66b685839ee2453b59fdad3967663c /test/ripper
parent6626f07017ff7b0065790363c0f3d6a3fc7f149f (diff)
downloadruby-d0187bcbc7ed7ecc473ea6f51115b5a317087950.tar.gz
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')
-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 c2084d8b01..b99feb7f83 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