* ext/psych/parser.c: parse raises a TypeError when nil is passed in.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2010-04-09 16:09:55 +00:00
parent 5869de449f
commit 052f204dcb
3 changed files with 11 additions and 0 deletions

View File

@ -1,3 +1,7 @@
Sat Apr 10 01:08:53 2010 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/parser.c: parse raises a TypeError when nil is passed in.
Sat Apr 10 00:01:51 2010 Yusuke Endoh <mame@tsg.ne.jp>
* ext/pty/lib/expect.rb: preserve buffer read, instead of discard.

View File

@ -57,6 +57,7 @@ static VALUE parse(VALUE self, VALUE yaml)
if(rb_respond_to(yaml, id_read)) {
yaml_parser_set_input(&parser, io_reader, (void *)yaml);
} else {
Check_Type(yaml, T_STRING);
yaml_parser_set_input_string(
&parser,
(const unsigned char *)StringValuePtr(yaml),

View File

@ -4,6 +4,12 @@ require 'stringio'
require 'tempfile'
class TestPsych < Psych::TestCase
def test_load_argument_error
assert_raises(TypeError) do
Psych.load nil
end
end
def test_dump_stream
things = [22, "foo \n", {}]
stream = Psych.dump_stream(*things)