mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
* ext/psych/parser.c: removed external encoding setter, allow parser
to be reused. * ext/psych/lib/psych/parser.rb: added external encoding setter. * test/psych/test_parser.rb: test parser reuse git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
14c97cf9b6
commit
59a1344808
4 changed files with 21 additions and 33 deletions
|
@ -32,6 +32,12 @@ module Psych
|
|||
@handler.parser = @parser
|
||||
end
|
||||
|
||||
def test_multiparse
|
||||
3.times do
|
||||
@parser.parse '--- foo'
|
||||
end
|
||||
end
|
||||
|
||||
def test_filename
|
||||
ex = assert_raises(Psych::SyntaxError) do
|
||||
@parser.parse '--- `', 'omg!'
|
||||
|
@ -87,15 +93,6 @@ module Psych
|
|||
assert_equal 19, @parser.mark.index
|
||||
end
|
||||
|
||||
def test_set_encoding_twice
|
||||
@parser.external_encoding = Psych::Parser::UTF16LE
|
||||
|
||||
e = assert_raises(Psych::Exception) do
|
||||
@parser.external_encoding = Psych::Parser::UTF16LE
|
||||
end
|
||||
assert_equal "don't set the encoding twice!", e.message
|
||||
end
|
||||
|
||||
def test_bom
|
||||
tadpole = 'おたまじゃくし'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue