summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-01-15 17:30:09 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-01-15 17:30:09 -0800
commit26fe5a33e9e4301c8a812205468b0f0ff026a164 (patch)
tree9709199a04d5bba203bd5e58ae700e894a95af44 /test
parentc4fbedc83020eef1a6143f7d64b3c0c748f5d9e5 (diff)
downloadpsych-26fe5a33e9e4301c8a812205468b0f0ff026a164.zip
raise an exception when bogus values are returned from an IO object
Diffstat (limited to 'test')
-rw-r--r--test/psych/test_parser.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/psych/test_parser.rb b/test/psych/test_parser.rb
index 197dde7..838fbe8 100644
--- a/test/psych/test_parser.rb
+++ b/test/psych/test_parser.rb
@@ -26,6 +26,15 @@ module Psych
@parser = Psych::Parser.new EventCatcher.new
end
+ def test_bogus_io
+ o = Object.new
+ def o.read len; self end
+
+ assert_raises(TypeError) do
+ @parser.parse o
+ end
+ end
+
def test_parse_io
@parser.parse StringIO.new("--- a")
assert_called :start_stream