From f506d5e4762b74536a5821392f06ec1c24e89536 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 8 Mar 2012 13:33:13 -0800 Subject: * ext/psych/lib/psych.rb (load, parse): stop parsing or loading after the first document has been parsed. * test/psych/test_stream.rb: pertinent tests. --- test/psych/test_stream.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/psych/test_stream.rb b/test/psych/test_stream.rb index 9807207..beca365 100644 --- a/test/psych/test_stream.rb +++ b/test/psych/test_stream.rb @@ -2,6 +2,16 @@ require 'psych/helper' module Psych class TestStream < TestCase + def test_parse_partial + rb = Psych.parse("--- foo\n...\n--- `").to_ruby + assert_equal 'foo', rb + end + + def test_load_partial + rb = Psych.load("--- foo\n...\n--- `") + assert_equal 'foo', rb + end + def test_parse_stream_yields_documents list = [] Psych.parse_stream("--- foo\n...\n--- bar") do |doc| -- cgit v1.2.3