psych 2.0.14-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +7 -0
  2. data/.autotest +18 -0
  3. data/.gemtest +0 -0
  4. data/.travis.yml +16 -0
  5. data/CHANGELOG.rdoc +576 -0
  6. data/Manifest.txt +114 -0
  7. data/README.rdoc +71 -0
  8. data/Rakefile +123 -0
  9. data/ext/psych/depend +3 -0
  10. data/ext/psych/extconf.rb +38 -0
  11. data/ext/psych/psych.c +34 -0
  12. data/ext/psych/psych.h +20 -0
  13. data/ext/psych/psych_emitter.c +555 -0
  14. data/ext/psych/psych_emitter.h +8 -0
  15. data/ext/psych/psych_parser.c +597 -0
  16. data/ext/psych/psych_parser.h +6 -0
  17. data/ext/psych/psych_to_ruby.c +43 -0
  18. data/ext/psych/psych_to_ruby.h +8 -0
  19. data/ext/psych/psych_yaml_tree.c +24 -0
  20. data/ext/psych/psych_yaml_tree.h +8 -0
  21. data/ext/psych/yaml/LICENSE +19 -0
  22. data/ext/psych/yaml/api.c +1415 -0
  23. data/ext/psych/yaml/config.h +10 -0
  24. data/ext/psych/yaml/dumper.c +394 -0
  25. data/ext/psych/yaml/emitter.c +2329 -0
  26. data/ext/psych/yaml/loader.c +459 -0
  27. data/ext/psych/yaml/parser.c +1370 -0
  28. data/ext/psych/yaml/reader.c +469 -0
  29. data/ext/psych/yaml/scanner.c +3576 -0
  30. data/ext/psych/yaml/writer.c +141 -0
  31. data/ext/psych/yaml/yaml.h +1971 -0
  32. data/ext/psych/yaml/yaml_private.h +664 -0
  33. data/lib/psych.jar +0 -0
  34. data/lib/psych.rb +504 -0
  35. data/lib/psych/class_loader.rb +101 -0
  36. data/lib/psych/coder.rb +94 -0
  37. data/lib/psych/core_ext.rb +35 -0
  38. data/lib/psych/deprecated.rb +85 -0
  39. data/lib/psych/exception.rb +13 -0
  40. data/lib/psych/handler.rb +249 -0
  41. data/lib/psych/handlers/document_stream.rb +22 -0
  42. data/lib/psych/handlers/recorder.rb +39 -0
  43. data/lib/psych/json/ruby_events.rb +19 -0
  44. data/lib/psych/json/stream.rb +16 -0
  45. data/lib/psych/json/tree_builder.rb +12 -0
  46. data/lib/psych/json/yaml_events.rb +29 -0
  47. data/lib/psych/nodes.rb +77 -0
  48. data/lib/psych/nodes/alias.rb +18 -0
  49. data/lib/psych/nodes/document.rb +60 -0
  50. data/lib/psych/nodes/mapping.rb +56 -0
  51. data/lib/psych/nodes/node.rb +55 -0
  52. data/lib/psych/nodes/scalar.rb +67 -0
  53. data/lib/psych/nodes/sequence.rb +81 -0
  54. data/lib/psych/nodes/stream.rb +37 -0
  55. data/lib/psych/omap.rb +4 -0
  56. data/lib/psych/parser.rb +51 -0
  57. data/lib/psych/scalar_scanner.rb +149 -0
  58. data/lib/psych/set.rb +4 -0
  59. data/lib/psych/stream.rb +37 -0
  60. data/lib/psych/streaming.rb +27 -0
  61. data/lib/psych/syntax_error.rb +21 -0
  62. data/lib/psych/tree_builder.rb +96 -0
  63. data/lib/psych/versions.rb +3 -0
  64. data/lib/psych/visitors.rb +6 -0
  65. data/lib/psych/visitors/depth_first.rb +26 -0
  66. data/lib/psych/visitors/emitter.rb +51 -0
  67. data/lib/psych/visitors/json_tree.rb +24 -0
  68. data/lib/psych/visitors/to_ruby.rb +404 -0
  69. data/lib/psych/visitors/visitor.rb +19 -0
  70. data/lib/psych/visitors/yaml_tree.rb +605 -0
  71. data/lib/psych/y.rb +9 -0
  72. data/lib/psych_jars.rb +5 -0
  73. data/test/psych/handlers/test_recorder.rb +25 -0
  74. data/test/psych/helper.rb +121 -0
  75. data/test/psych/json/test_stream.rb +109 -0
  76. data/test/psych/nodes/test_enumerable.rb +43 -0
  77. data/test/psych/test_alias_and_anchor.rb +96 -0
  78. data/test/psych/test_array.rb +57 -0
  79. data/test/psych/test_boolean.rb +36 -0
  80. data/test/psych/test_class.rb +36 -0
  81. data/test/psych/test_coder.rb +206 -0
  82. data/test/psych/test_date_time.rb +38 -0
  83. data/test/psych/test_deprecated.rb +214 -0
  84. data/test/psych/test_document.rb +46 -0
  85. data/test/psych/test_emitter.rb +93 -0
  86. data/test/psych/test_encoding.rb +259 -0
  87. data/test/psych/test_exception.rb +157 -0
  88. data/test/psych/test_hash.rb +94 -0
  89. data/test/psych/test_json_tree.rb +65 -0
  90. data/test/psych/test_merge_keys.rb +180 -0
  91. data/test/psych/test_nil.rb +18 -0
  92. data/test/psych/test_null.rb +19 -0
  93. data/test/psych/test_numeric.rb +45 -0
  94. data/test/psych/test_object.rb +44 -0
  95. data/test/psych/test_object_references.rb +71 -0
  96. data/test/psych/test_omap.rb +75 -0
  97. data/test/psych/test_parser.rb +339 -0
  98. data/test/psych/test_psych.rb +168 -0
  99. data/test/psych/test_safe_load.rb +97 -0
  100. data/test/psych/test_scalar.rb +11 -0
  101. data/test/psych/test_scalar_scanner.rb +106 -0
  102. data/test/psych/test_serialize_subclasses.rb +38 -0
  103. data/test/psych/test_set.rb +49 -0
  104. data/test/psych/test_stream.rb +93 -0
  105. data/test/psych/test_string.rb +226 -0
  106. data/test/psych/test_struct.rb +49 -0
  107. data/test/psych/test_symbol.rb +25 -0
  108. data/test/psych/test_tainted.rb +130 -0
  109. data/test/psych/test_to_yaml_properties.rb +63 -0
  110. data/test/psych/test_tree_builder.rb +79 -0
  111. data/test/psych/test_yaml.rb +1292 -0
  112. data/test/psych/test_yamldbm.rb +193 -0
  113. data/test/psych/test_yamlstore.rb +85 -0
  114. data/test/psych/visitors/test_depth_first.rb +49 -0
  115. data/test/psych/visitors/test_emitter.rb +144 -0
  116. data/test/psych/visitors/test_to_ruby.rb +333 -0
  117. data/test/psych/visitors/test_yaml_tree.rb +173 -0
  118. metadata +240 -0
@@ -0,0 +1,46 @@
1
+ require_relative 'helper'
2
+
3
+ module Psych
4
+ class TestDocument < TestCase
5
+ def setup
6
+ super
7
+ @stream = Psych.parse_stream(<<-eoyml)
8
+ %YAML 1.1
9
+ %TAG ! tag:tenderlovemaking.com,2009:
10
+ --- !fun
11
+ eoyml
12
+ @doc = @stream.children.first
13
+ end
14
+
15
+ def test_parse_tag
16
+ assert_equal([['!', 'tag:tenderlovemaking.com,2009:']],
17
+ @doc.tag_directives)
18
+ end
19
+
20
+ def test_emit_tag
21
+ assert_match('%TAG ! tag:tenderlovemaking.com,2009:', @stream.yaml)
22
+ end
23
+
24
+ def test_emit_multitag
25
+ @doc.tag_directives << ['!!', 'foo.com,2009:']
26
+ yaml = @stream.yaml
27
+ assert_match('%TAG ! tag:tenderlovemaking.com,2009:', yaml)
28
+ assert_match('%TAG !! foo.com,2009:', yaml)
29
+ end
30
+
31
+ def test_emit_bad_tag
32
+ assert_raises(RuntimeError) do
33
+ @doc.tag_directives = [['!']]
34
+ @stream.yaml
35
+ end
36
+ end
37
+
38
+ def test_parse_version
39
+ assert_equal([1,1], @doc.version)
40
+ end
41
+
42
+ def test_emit_version
43
+ assert_match('%YAML 1.1', @stream.yaml)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,93 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require_relative 'helper'
4
+
5
+ module Psych
6
+ class TestEmitter < TestCase
7
+ def setup
8
+ super
9
+ @out = StringIO.new('')
10
+ @emitter = Psych::Emitter.new @out
11
+ end
12
+
13
+ def test_line_width
14
+ @emitter.line_width = 10
15
+ assert_equal 10, @emitter.line_width
16
+ end
17
+
18
+ def test_set_canonical
19
+ @emitter.canonical = true
20
+ assert_equal true, @emitter.canonical
21
+
22
+ @emitter.canonical = false
23
+ assert_equal false, @emitter.canonical
24
+ end
25
+
26
+ def test_indentation_set
27
+ assert_equal 2, @emitter.indentation
28
+ @emitter.indentation = 5
29
+ assert_equal 5, @emitter.indentation
30
+ end
31
+
32
+ def test_emit_utf_8
33
+ @emitter.start_stream Psych::Nodes::Stream::UTF8
34
+ @emitter.start_document [], [], false
35
+ @emitter.scalar '日本語', nil, nil, false, true, 1
36
+ @emitter.end_document true
37
+ @emitter.end_stream
38
+ assert_match('日本語', @out.string)
39
+ end
40
+
41
+ def test_start_stream_arg_error
42
+ assert_raises(TypeError) do
43
+ @emitter.start_stream 'asdfasdf'
44
+ end
45
+ end
46
+
47
+ def test_start_doc_arg_error
48
+ @emitter.start_stream Psych::Nodes::Stream::UTF8
49
+
50
+ [
51
+ [nil, [], false],
52
+ [[nil, nil], [], false],
53
+ [[], 'foo', false],
54
+ [[], ['foo'], false],
55
+ [[], [nil,nil], false],
56
+ ].each do |args|
57
+ assert_raises(TypeError) do
58
+ @emitter.start_document(*args)
59
+ end
60
+ end
61
+ end
62
+
63
+ def test_scalar_arg_error
64
+ @emitter.start_stream Psych::Nodes::Stream::UTF8
65
+ @emitter.start_document [], [], false
66
+
67
+ [
68
+ [:foo, nil, nil, false, true, 1],
69
+ ['foo', Object.new, nil, false, true, 1],
70
+ ['foo', nil, Object.new, false, true, 1],
71
+ ['foo', nil, nil, false, true, :foo],
72
+ [nil, nil, nil, false, true, 1],
73
+ ].each do |args|
74
+ assert_raises(TypeError) do
75
+ @emitter.scalar(*args)
76
+ end
77
+ end
78
+ end
79
+
80
+ def test_start_sequence_arg_error
81
+ @emitter.start_stream Psych::Nodes::Stream::UTF8
82
+ @emitter.start_document [], [], false
83
+
84
+ assert_raises(TypeError) do
85
+ @emitter.start_sequence(nil, Object.new, true, 1)
86
+ end
87
+
88
+ assert_raises(TypeError) do
89
+ @emitter.start_sequence(nil, nil, true, :foo)
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,259 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require_relative 'helper'
4
+
5
+ module Psych
6
+ class TestEncoding < TestCase
7
+ class EncodingCatcher < Handler
8
+ attr_reader :strings
9
+ def initialize
10
+ @strings = []
11
+ end
12
+
13
+ (Handler.instance_methods(true) -
14
+ Object.instance_methods).each do |m|
15
+ class_eval %{
16
+ def #{m} *args
17
+ @strings += args.flatten.find_all { |a|
18
+ String === a
19
+ }
20
+ end
21
+ }
22
+ end
23
+ end
24
+
25
+ def setup
26
+ super
27
+ @buffer = StringIO.new
28
+ @handler = EncodingCatcher.new
29
+ @parser = Psych::Parser.new @handler
30
+ @utf8 = Encoding.find('UTF-8')
31
+ @emitter = Psych::Emitter.new @buffer
32
+ end
33
+
34
+ def test_dump_load_encoding_object
35
+ assert_cycle Encoding::US_ASCII
36
+ assert_cycle Encoding::UTF_8
37
+ end
38
+
39
+ def test_transcode_shiftjis
40
+ str = "こんにちは!"
41
+ loaded = Psych.load("--- こんにちは!".encode('SHIFT_JIS'))
42
+ assert_equal str, loaded
43
+ end
44
+
45
+ def test_transcode_utf16le
46
+ str = "こんにちは!"
47
+ loaded = Psych.load("--- こんにちは!".encode('UTF-16LE'))
48
+ assert_equal str, loaded
49
+ end
50
+
51
+ def test_transcode_utf16be
52
+ str = "こんにちは!"
53
+ loaded = Psych.load("--- こんにちは!".encode('UTF-16BE'))
54
+ assert_equal str, loaded
55
+ end
56
+
57
+ def test_io_shiftjis
58
+ Tempfile.create(['shiftjis', 'yml'], :encoding => 'SHIFT_JIS') {|t|
59
+ t.write '--- こんにちは!'
60
+ t.close
61
+
62
+ # If the external encoding isn't utf8, utf16le, or utf16be, we cannot
63
+ # process the file.
64
+ File.open(t.path, 'r', :encoding => 'SHIFT_JIS') do |f|
65
+ assert_raises Psych::SyntaxError do
66
+ Psych.load(f)
67
+ end
68
+ end
69
+ }
70
+ end
71
+
72
+ def test_io_utf16le
73
+ Tempfile.create(['utf16le', 'yml']) {|t|
74
+ t.binmode
75
+ t.write '--- こんにちは!'.encode('UTF-16LE')
76
+ t.close
77
+
78
+ File.open(t.path, 'rb', :encoding => 'UTF-16LE') do |f|
79
+ assert_equal "こんにちは!", Psych.load(f)
80
+ end
81
+ }
82
+ end
83
+
84
+ def test_io_utf16be
85
+ Tempfile.create(['utf16be', 'yml']) {|t|
86
+ t.binmode
87
+ t.write '--- こんにちは!'.encode('UTF-16BE')
88
+ t.close
89
+
90
+ File.open(t.path, 'rb', :encoding => 'UTF-16BE') do |f|
91
+ assert_equal "こんにちは!", Psych.load(f)
92
+ end
93
+ }
94
+ end
95
+
96
+ def test_io_utf8
97
+ Tempfile.create(['utf8', 'yml']) {|t|
98
+ t.binmode
99
+ t.write '--- こんにちは!'.encode('UTF-8')
100
+ t.close
101
+
102
+ File.open(t.path, 'rb', :encoding => 'UTF-8') do |f|
103
+ assert_equal "こんにちは!", Psych.load(f)
104
+ end
105
+ }
106
+ end
107
+
108
+ def test_emit_alias
109
+ @emitter.start_stream Psych::Parser::UTF8
110
+ @emitter.start_document [], [], true
111
+ e = assert_raises(RuntimeError) do
112
+ @emitter.alias 'ドラえもん'.encode('EUC-JP')
113
+ end
114
+ assert_match(/alias value/, e.message)
115
+ end
116
+
117
+ def test_to_yaml_is_valid
118
+ with_default_external(Encoding::US_ASCII) do
119
+ with_default_internal(nil) do
120
+ s = "こんにちは!"
121
+ # If no encoding is specified, use UTF-8
122
+ assert_equal Encoding::UTF_8, Psych.dump(s).encoding
123
+ assert_equal s, Psych.load(Psych.dump(s))
124
+ end
125
+ end
126
+ end
127
+
128
+ def test_start_mapping
129
+ foo = 'foo'
130
+ bar = 'バー'
131
+
132
+ @emitter.start_stream Psych::Parser::UTF8
133
+ @emitter.start_document [], [], true
134
+ @emitter.start_mapping(
135
+ foo.encode('Shift_JIS'),
136
+ bar.encode('UTF-16LE'),
137
+ false, Nodes::Sequence::ANY)
138
+ @emitter.end_mapping
139
+ @emitter.end_document false
140
+ @emitter.end_stream
141
+
142
+ @parser.parse @buffer.string
143
+ assert_encodings @utf8, @handler.strings
144
+ assert_equal [foo, bar], @handler.strings
145
+ end
146
+
147
+ def test_start_sequence
148
+ foo = 'foo'
149
+ bar = 'バー'
150
+
151
+ @emitter.start_stream Psych::Parser::UTF8
152
+ @emitter.start_document [], [], true
153
+ @emitter.start_sequence(
154
+ foo.encode('Shift_JIS'),
155
+ bar.encode('UTF-16LE'),
156
+ false, Nodes::Sequence::ANY)
157
+ @emitter.end_sequence
158
+ @emitter.end_document false
159
+ @emitter.end_stream
160
+
161
+ @parser.parse @buffer.string
162
+ assert_encodings @utf8, @handler.strings
163
+ assert_equal [foo, bar], @handler.strings
164
+ end
165
+
166
+ def test_doc_tag_encoding
167
+ key = '鍵'
168
+ @emitter.start_stream Psych::Parser::UTF8
169
+ @emitter.start_document(
170
+ [1, 1],
171
+ [['!'.encode('EUC-JP'), key.encode('EUC-JP')]],
172
+ true
173
+ )
174
+ @emitter.scalar 'foo', nil, nil, true, false, Nodes::Scalar::ANY
175
+ @emitter.end_document false
176
+ @emitter.end_stream
177
+
178
+ @parser.parse @buffer.string
179
+ assert_encodings @utf8, @handler.strings
180
+ assert_equal key, @handler.strings[1]
181
+ end
182
+
183
+ def test_emitter_encoding
184
+ str = "壁に耳あり、障子に目あり"
185
+ thing = Psych.load Psych.dump str.encode('EUC-JP')
186
+ assert_equal str, thing
187
+ end
188
+
189
+ def test_default_internal
190
+ with_default_internal(Encoding::EUC_JP) do
191
+ str = "壁に耳あり、障子に目あり"
192
+ assert_equal @utf8, str.encoding
193
+
194
+ @parser.parse str
195
+ assert_encodings Encoding::EUC_JP, @handler.strings
196
+ assert_equal str, @handler.strings.first.encode('UTF-8')
197
+ end
198
+ end
199
+
200
+ def test_scalar
201
+ @parser.parse("--- a")
202
+ assert_encodings @utf8, @handler.strings
203
+ end
204
+
205
+ def test_alias
206
+ @parser.parse(<<-eoyml)
207
+ %YAML 1.1
208
+ ---
209
+ !!seq [
210
+ !!str "Without properties",
211
+ &A !!str "Anchored",
212
+ !!str "Tagged",
213
+ *A,
214
+ !!str "",
215
+ ]
216
+ eoyml
217
+ assert_encodings @utf8, @handler.strings
218
+ end
219
+
220
+ def test_list_anchor
221
+ list = %w{ a b }
222
+ list << list
223
+ @parser.parse(Psych.dump(list))
224
+ assert_encodings @utf8, @handler.strings
225
+ end
226
+
227
+ def test_map_anchor
228
+ h = {}
229
+ h['a'] = h
230
+ @parser.parse(Psych.dump(h))
231
+ assert_encodings @utf8, @handler.strings
232
+ end
233
+
234
+ def test_map_tag
235
+ @parser.parse(<<-eoyml)
236
+ %YAML 1.1
237
+ ---
238
+ !!map { a : b }
239
+ eoyml
240
+ assert_encodings @utf8, @handler.strings
241
+ end
242
+
243
+ def test_doc_tag
244
+ @parser.parse(<<-eoyml)
245
+ %YAML 1.1
246
+ %TAG ! tag:tenderlovemaking.com,2009:
247
+ --- !fun
248
+ eoyml
249
+ assert_encodings @utf8, @handler.strings
250
+ end
251
+
252
+ private
253
+ def assert_encodings encoding, strings
254
+ strings.each do |str|
255
+ assert_equal encoding, str.encoding, str
256
+ end
257
+ end
258
+ end
259
+ end
@@ -0,0 +1,157 @@
1
+ require_relative 'helper'
2
+
3
+ module Psych
4
+ class TestException < TestCase
5
+ class Wups < Exception
6
+ attr_reader :foo, :bar
7
+ def initialize *args
8
+ super
9
+ @foo = 1
10
+ @bar = 2
11
+ end
12
+ end
13
+
14
+ def setup
15
+ super
16
+ @wups = Wups.new
17
+ end
18
+
19
+ def test_naming_exception
20
+ err = String.xxx rescue $!
21
+ new_err = Psych.load(Psych.dump(err))
22
+ assert_equal err.message, new_err.message
23
+ end
24
+
25
+ def test_load_takes_file
26
+ ex = assert_raises(Psych::SyntaxError) do
27
+ Psych.load '--- `'
28
+ end
29
+ assert_nil ex.file
30
+
31
+ ex = assert_raises(Psych::SyntaxError) do
32
+ Psych.load '--- `', 'meow'
33
+ end
34
+ assert_equal 'meow', ex.file
35
+ end
36
+
37
+ def test_psych_parse_stream_takes_file
38
+ ex = assert_raises(Psych::SyntaxError) do
39
+ Psych.parse_stream '--- `'
40
+ end
41
+ assert_nil ex.file
42
+ assert_match '(<unknown>)', ex.message
43
+
44
+ ex = assert_raises(Psych::SyntaxError) do
45
+ Psych.parse_stream '--- `', 'omg!'
46
+ end
47
+ assert_equal 'omg!', ex.file
48
+ assert_match 'omg!', ex.message
49
+ end
50
+
51
+ def test_load_stream_takes_file
52
+ ex = assert_raises(Psych::SyntaxError) do
53
+ Psych.load_stream '--- `'
54
+ end
55
+ assert_nil ex.file
56
+ assert_match '(<unknown>)', ex.message
57
+
58
+ ex = assert_raises(Psych::SyntaxError) do
59
+ Psych.load_stream '--- `', 'omg!'
60
+ end
61
+ assert_equal 'omg!', ex.file
62
+ end
63
+
64
+ def test_parse_file_exception
65
+ Tempfile.create(['parsefile', 'yml']) {|t|
66
+ t.binmode
67
+ t.write '--- `'
68
+ t.close
69
+ ex = assert_raises(Psych::SyntaxError) do
70
+ Psych.parse_file t.path
71
+ end
72
+ assert_equal t.path, ex.file
73
+ }
74
+ end
75
+
76
+ def test_load_file_exception
77
+ Tempfile.create(['loadfile', 'yml']) {|t|
78
+ t.binmode
79
+ t.write '--- `'
80
+ t.close
81
+ ex = assert_raises(Psych::SyntaxError) do
82
+ Psych.load_file t.path
83
+ end
84
+ assert_equal t.path, ex.file
85
+ }
86
+ end
87
+
88
+ def test_psych_parse_takes_file
89
+ ex = assert_raises(Psych::SyntaxError) do
90
+ Psych.parse '--- `'
91
+ end
92
+ assert_match '(<unknown>)', ex.message
93
+ assert_nil ex.file
94
+
95
+ ex = assert_raises(Psych::SyntaxError) do
96
+ Psych.parse '--- `', 'omg!'
97
+ end
98
+ assert_match 'omg!', ex.message
99
+ end
100
+
101
+ def test_attributes
102
+ e = assert_raises(Psych::SyntaxError) {
103
+ Psych.load '--- `foo'
104
+ }
105
+
106
+ assert_nil e.file
107
+ assert_equal 1, e.line
108
+ assert_equal 5, e.column
109
+ # FIXME: offset isn't being set correctly by libyaml
110
+ # assert_equal 5, e.offset
111
+
112
+ assert e.problem
113
+ assert e.context
114
+ end
115
+
116
+ def test_convert
117
+ w = Psych.load(Psych.dump(@wups))
118
+ assert_equal @wups, w
119
+ assert_equal 1, w.foo
120
+ assert_equal 2, w.bar
121
+ end
122
+
123
+ def test_to_yaml_properties
124
+ class << @wups
125
+ def to_yaml_properties
126
+ [:@foo]
127
+ end
128
+ end
129
+
130
+ w = Psych.load(Psych.dump(@wups))
131
+ assert_equal @wups, w
132
+ assert_equal 1, w.foo
133
+ assert_nil w.bar
134
+ end
135
+
136
+ def test_psych_syntax_error
137
+ Tempfile.create(['parsefile', 'yml']) do |t|
138
+ t.binmode
139
+ t.write '--- `'
140
+ t.close
141
+
142
+ begin
143
+ Psych.parse_file t.path
144
+ rescue StandardError
145
+ assert true # count assertion
146
+ ensure
147
+ return unless $!
148
+
149
+ ancestors = $!.class.ancestors.inspect
150
+
151
+ flunk "Psych::SyntaxError not rescued by StandardError: #{ancestors}"
152
+ end
153
+ end
154
+ end
155
+
156
+ end
157
+ end