yamlr 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ 2341234
2
+ awesome
3
+ dude
@@ -0,0 +1,12 @@
1
+ 1:1
2
+ 2:
3
+ -
4
+ - one
5
+ - two
6
+ 5:
7
+ 6:6
8
+ 7:7
9
+ 8:
10
+ dude:dude
11
+ -
12
+ 3: awesome
@@ -0,0 +1,9 @@
1
+ 1: awesome
2
+ 2: dude
3
+ 3:
4
+ 1: niceone
5
+ 2: bro
6
+ 3:
7
+ 1: beer
8
+ 2: camaro
9
+ fekja: bacon
@@ -0,0 +1,9 @@
1
+ 1:1
2
+ 2:3
3
+ 3:3
4
+ - 1
5
+ - 2
6
+ - 3
7
+ 1:1
8
+ 2:2
9
+ 3:3
@@ -0,0 +1,210 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ require 'rubygems'
4
+ require 'minitest/unit'
5
+ $: << 'lib' << 'test'
6
+ require 'yamlr/reader'
7
+ require 'yamlr/indicators'
8
+ require 'yamlr/defaults'
9
+ MiniTest::Unit.autorun
10
+
11
+ class TestReader < MiniTest::Unit::TestCase
12
+ def setup
13
+ @file_com = "test/files/comments.yml"
14
+ @file_arr = "test/files/arrays.yml"
15
+ @file_hsh = "test/files/hashes.yml"
16
+ @file_mix = "test/files/mixed.yml"
17
+ @file_mal = "test/files/malformed.yml"
18
+ @file_bla = "test/files/blank.yml"
19
+ @file_spl = "test/files/split.yml"
20
+ opt = Yamlr::Indicators.options
21
+ @opt = Yamlr::Defaults.options.merge(opt)
22
+ @reader = Yamlr::Reader
23
+ end
24
+
25
+ def test_test_files_exists
26
+ assert File.exists?(@file_com)
27
+ assert File.exists?(@file_arr)
28
+ assert File.exists?(@file_hsh)
29
+ assert File.exists?(@file_mix)
30
+ assert File.exists?(@file_mal)
31
+ assert File.exists?(@file_bla)
32
+ assert File.exists?(@file_spl)
33
+ end
34
+
35
+ def test_parse_string
36
+ exp1 = {"awesome" => "dude"}
37
+ exp2 = {1 => {"awesome" => "dude"}, :lst => {1 => "1"}}
38
+ act1 = @reader.read("awesome: dude", @opt.merge({:list => false}))
39
+ act2 = @reader.read("awesome: dude", @opt.merge({:list => true}))
40
+ assert_equal exp1, act1
41
+ assert_equal exp2, act2
42
+ end
43
+
44
+ def test_parse_empty_string_raise_emptystringerror
45
+ assert_raises(Yamlr::Reader::EmptyInputError) {@reader.read("", @opt)}
46
+ end
47
+
48
+ def test_parse_blank_file_raise_emptyfileerror
49
+ assert_raises(Yamlr::Reader::EmptyFileError) {@reader.read(@file_bla, @opt)}
50
+ end
51
+
52
+ def test_parse_blank_file_raise_invalidinputerror
53
+ assert_raises(Yamlr::Reader::InvalidInputError) {@reader.read({}, @opt)}
54
+ end
55
+
56
+ def test_parse_split_raise_rootnodeerror
57
+ assert_raises(Yamlr::Reader::Builder::RootNodeError) {
58
+ @reader.read(@file_spl, @opt.merge({:list => true}))
59
+ }
60
+ end
61
+
62
+ def test_parse_file_array
63
+ exp1 = ["", 1, 2, [["", "awesome", "awesome"]], 4, 5, 6, [7, [8], "dude"], ""]
64
+ exp2 = {1 => ["", 1, 2, [["", "awesome", "awesome"]], 4, 5, 6, [7, [8], "dude"], ""],
65
+ :lst=> {
66
+ 1 => "1",
67
+ 2 => "1",
68
+ 3 => "1",
69
+ 4 => "1",
70
+ 5 => "1,3",
71
+ 6 => "1,3,0",
72
+ 7 => "1,3,0",
73
+ 8 => "1,3,0",
74
+ 9 => "1",
75
+ 10 => "1",
76
+ 11 => "1",
77
+ 12 => "1,7",
78
+ 13 => "1,7,1",
79
+ 14 => "1,7",
80
+ 15 => "1"}}
81
+ act1 = @reader.read(@file_arr, @opt.merge({:list => false}))
82
+ act2 = @reader.read(@file_arr, @opt.merge({:list => true}))
83
+ assert_equal exp1, act1
84
+ assert_equal exp2, act2
85
+ end
86
+
87
+ def test_parse_file_hash
88
+ exp1 = {"grocery_list" =>
89
+ {"meatsez" =>
90
+ {1 => {"count" => 5, "model" => "Spam"},
91
+ 2 => {"count" => 1, "model" => "Log of ground beef"}},
92
+ "beer" => {1 => {"count" => 1, "model" => "24 pack - Coors Lite"}},
93
+ "cigarettes" =>
94
+ {1 => {"count" => 2, "model" => "Carton - Basic Ultra Menthol Box 100"}},
95
+ "other" =>
96
+ {1 => {"count" => 2, "model" => "Economy-Size Pork & Beans"},
97
+ 2 => {"count" => 1, "model" => "Jumbo Miracle Whip"},
98
+ 3 => {"count" => 2, "model" => "White Wonder Bread"}}}}
99
+ exp2 = {1 => {"grocery_list" =>
100
+ {"meatsez" =>
101
+ {1 => {"count" => 5, "model" => "Spam"},
102
+ 2 => {"count" => 1, "model" => "Log of ground beef"}},
103
+ "beer" => {1 => {"count" => 1, "model" => "24 pack - Coors Lite"}},
104
+ "cigarettes" =>
105
+ {1 => {"count" => 2, "model" => "Carton - Basic Ultra Menthol Box 100"}},
106
+ "other" =>
107
+ {1 => {"count" => 2, "model" => "Economy-Size Pork & Beans"},
108
+ 2 => {"count" => 1, "model" => "Jumbo Miracle Whip"},
109
+ 3 => {"count" => 2, "model" => "White Wonder Bread"}}}},
110
+ :lst =>
111
+ {1 => "1,grocery_list",
112
+ 2 => "1,grocery_list,beer",
113
+ 3 => "1,grocery_list,beer,1",
114
+ 4 => "1,grocery_list,beer,1",
115
+ 5 => "1,grocery_list,beer,1",
116
+ 6 => "1,grocery_list,meatsez",
117
+ 7 => "1,grocery_list,meatsez,1",
118
+ 8 => "1,grocery_list,meatsez,1",
119
+ 9 => "1,grocery_list,meatsez,1",
120
+ 10 => "1,grocery_list,meatsez,2",
121
+ 11 => "1,grocery_list,meatsez,2",
122
+ 12 => "1,grocery_list,meatsez,2",
123
+ 13 => "1,grocery_list,cigarettes",
124
+ 14 => "1,grocery_list,cigarettes,1",
125
+ 15 => "1,grocery_list,cigarettes,1",
126
+ 16 => "1,grocery_list,cigarettes,1",
127
+ 17 => "1,grocery_list,other",
128
+ 18 => "1,grocery_list,other,1",
129
+ 19 => "1,grocery_list,other,1",
130
+ 20 => "1,grocery_list,other,1",
131
+ 21 => "1,grocery_list,other,2",
132
+ 22 => "1,grocery_list,other,2",
133
+ 23 => "1,grocery_list,other,2",
134
+ 24 => "1,grocery_list,other,3",
135
+ 25 => "1,grocery_list,other,3",
136
+ 26 => "1,grocery_list,other,3"}}
137
+ act1 = @reader.read(@file_hsh, @opt.merge({:list => false}))
138
+ act2 = @reader.read(@file_hsh, @opt.merge({:list => true}))
139
+ assert_equal exp1, act1
140
+ assert_equal exp2, act2
141
+ end
142
+
143
+ def test_parse_file_mixed
144
+ exp1 = {1=>1,
145
+ 2 => ["", "one", "two", {5=>{6=>6, 7=>7}, 8=>{"dude"=>"dude"}}, ""],
146
+ 3 =>"awesome"}
147
+ exp2 = {1=>
148
+ {1=>1,
149
+ 2=>["", "one", "two", {5=>{6=>6, 7=>7}, 8=>{"dude"=>"dude"}}, ""],
150
+ 3=>"awesome"},
151
+ :lst => {
152
+ 1 => "1",
153
+ 2 => "1,2",
154
+ 3 => "1,2",
155
+ 4 => "1,2",
156
+ 5 => "1,2",
157
+ 6 => "1,2,3,5",
158
+ 7 => "1,2,3,5",
159
+ 8 => "1,2,3,5",
160
+ 9 => "1,2,3,8",
161
+ 10 => "1,2,3,8",
162
+ 11 => "1,2",
163
+ 12 => "1"}}
164
+ act1 = @reader.read(@file_mix, @opt.merge({:list => false}))
165
+ act2 = @reader.read(@file_mix, @opt.merge({:list => true}))
166
+ assert_equal exp1, act1
167
+ assert_equal exp2, act2
168
+ end
169
+
170
+ def test_parse_file_comments
171
+ exp1 = {1=>1, 2=>2, 3=>3, 4=>[1, 2, 3]}
172
+ exp2 = {1=>{1=>1, 2=>2, 3=>3, 4=>[1, 2, 3]},
173
+ :lst => {
174
+ 1 => "#COMMENT: dude",
175
+ 2 => "1",
176
+ 3 => "#COMMENT: awesome",
177
+ 4 => "1",
178
+ 5 => "#COMMENT: ",
179
+ 6 => "#COMMENT: camaro",
180
+ 7 => "#COMMENT: ",
181
+ 8 => "1",
182
+ 9 => "#COMMENT: #",
183
+ 10 => "#COMMENT: nice",
184
+ 11 => "#COMMENT: one",
185
+ 12 => "#COMMENT: bro!",
186
+ 13 => "#COMMENT: ",
187
+ 14 => "1,4",
188
+ 15 => "1,4",
189
+ 16 => "1,4",
190
+ 17 => "1,4"}}
191
+ act1 = @reader.read(@file_com, @opt.merge({:list => false}))
192
+ act2 = @reader.read(@file_com, @opt.merge({:list => true}))
193
+ assert_equal exp1, act1
194
+ assert_equal exp2, act2
195
+ end
196
+
197
+ def test_parse_file_malformed
198
+ exp1 = {}
199
+ exp2 = {
200
+ 1=>{},
201
+ :lst => {
202
+ 1 => "#MALFORMED: 2341234",
203
+ 2 => "#MALFORMED: awesome",
204
+ 3 => "#MALFORMED: dude"}}
205
+ act1 = @reader.read(@file_mal, @opt.merge({:list => false}))
206
+ act2 = @reader.read(@file_mal, @opt.merge({:list => true}))
207
+ assert_equal exp1, act1
208
+ assert_equal exp2, act2
209
+ end
210
+ end
@@ -0,0 +1,342 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ $: << 'lib' << 'test'
4
+ require "minitest/autorun"
5
+ require 'yamlr/reader/builder'
6
+
7
+ class TestReaderBuilder < MiniTest::Unit::TestCase
8
+ def setup
9
+ @builder = Yamlr::Reader::Builder
10
+ @phash = { :msg => nil,
11
+ :spc => nil,
12
+ :key => nil,
13
+ :val => nil,
14
+ :ask => false,
15
+ :asv => false,
16
+ :opt => {:indent => 2}}
17
+ @dcs = @phash.merge({:msg => :dcs})
18
+ @dct = @phash.merge({:msg => :dct})
19
+ @hpr = @phash.merge({:msg => :hpr})
20
+ @hky = @phash.merge({:msg => :hky})
21
+ @arr = @phash.merge({:msg => :arr})
22
+ @mal = @phash.merge({:msg => :mal})
23
+ end
24
+
25
+ # build
26
+ #
27
+ def test_build_module
28
+ assert_kind_of Module, @builder
29
+ end
30
+
31
+ def test_build_array_raise_rootnodeerror
32
+ hsh = {1 =>{"k1" => "awesome"}, :lst => {1 => "k1"}, :adr => [1,"k1"]}
33
+ val = "dude"
34
+ phs = @arr.merge({:val => val, :spc => 0})
35
+ assert_raises(Yamlr::Reader::Builder::RootNodeError) {@builder.build(hsh, phs)}
36
+ end
37
+
38
+ def test_build_array_with_zero_indent
39
+ hsh = {}
40
+ val = "awesome"
41
+ phs = @arr.merge({:val => val, :spc => 0})
42
+ @builder.build(hsh, phs)
43
+ assert_equal(["awesome"], hsh[1])
44
+ end
45
+
46
+ def test_build_array_into_hashkey
47
+ hsh = {:adr => [1, "k1"], 1 => {"k1" => {}}, :lst =>{}}
48
+ exp = {"k1" => ["awesome"]}
49
+ val = "awesome"
50
+ phs = @arr.merge({:val => val, :spc => 2})
51
+ @builder.build(hsh, phs)
52
+ assert_equal exp, hsh[1]
53
+ end
54
+
55
+ def test_build_add_blank
56
+ hsh = {:adr => [1], 1 => {}, :lst => {}}
57
+ exp_lst1 = {1 => "#BLANK"}
58
+ exp_lst2 = {1 => "#BLANK", 2 => "#BLANK"}
59
+ @builder.build(hsh, {:msg => :bla})
60
+ assert_equal exp_lst1, hsh[:lst]
61
+ @builder.build(hsh, {:msg => :bla})
62
+ assert_equal exp_lst2, hsh[:lst]
63
+ end
64
+
65
+ def test_build_malformed
66
+ hsh = {:adr => [1], 1 => {}, :lst => {}}
67
+ exp_lst1 = {1 => "#BLANK"}
68
+ exp_lst2 = {1 => "#BLANK", 2 => "#BLANK"}
69
+ @builder.build(hsh, {:msg => :bla})
70
+ assert_equal exp_lst1, hsh[:lst]
71
+ @builder.build(hsh, {:msg => :bla})
72
+ assert_equal exp_lst2, hsh[:lst]
73
+ end
74
+
75
+ def test_build_array_into_array
76
+ hsh = {:adr => [1, "k1"], 1 => {"k1" => [1,2]}, :lst =>{}}
77
+ val = "awesome"
78
+ phs = @arr.merge({:val => val, :spc => 4})
79
+ @builder.build(hsh, phs)
80
+ exp_hsh = {"k1" => [1,2,["awesome"]]}
81
+ exp_adr = [1, "k1", 2]
82
+ assert_equal exp_hsh, hsh[1]
83
+ assert_equal exp_adr, hsh[:adr]
84
+ end
85
+
86
+ def test_build_hashpair_into_array
87
+ hsh = {:adr => [1, 0], 1 => [["awesome"]], :lst =>{}}
88
+ phs = @hpr.merge({:key => "dude", :val => "fekja", :spc => 2})
89
+ @builder.build(hsh, phs)
90
+ exp_hsh = [["awesome", {"dude" => "fekja"}]]
91
+ exp_adr = [1, 0]
92
+ assert_equal exp_hsh, hsh[1]
93
+ assert_equal exp_adr, hsh[:adr]
94
+ end
95
+
96
+ def test_build_hashkey_into_array
97
+ hsh = {:adr => [1, 0], 1 => [["awesome"]], :lst =>{}}
98
+ phs = @hky.merge({:key => "dude", :spc => 2})
99
+ @builder.build(hsh, phs)
100
+ exp_hsh = [["awesome", {"dude" => {}}]]
101
+ exp_adr = [1, 0, 1, "dude"]
102
+ assert_equal exp_hsh, hsh[1]
103
+ assert_equal exp_adr, hsh[:adr]
104
+ end
105
+
106
+ def test_cur
107
+ hsh1 = {:adr => [], :lst => {}, 1=>[7]}
108
+ hsh2 = {:adr => [], :lst => {}, 1=>[7], 2=>[8]}
109
+ exp_hsh1 = [7]
110
+ exp_hsh2 = [8]
111
+ act_hsh1 = @builder.cur(hsh1)
112
+ act_hsh2 = @builder.cur(hsh2)
113
+ assert_equal exp_hsh1, act_hsh1
114
+ assert_equal exp_hsh2, act_hsh2
115
+ end
116
+
117
+ def test_doc_new
118
+ exp1 = {:adr => [1], :lst => {}, 1=>{}}
119
+ exp2 = {:adr => [2], :lst => {}, 1=>{}, 2=>{}}
120
+ hsh = {}
121
+ @builder.doc_new(hsh)
122
+ assert_equal exp1, hsh
123
+ @builder.doc_new(hsh)
124
+ assert_equal exp2, hsh
125
+ end
126
+
127
+ def test_space
128
+ assert_equal 1, @builder.index(2,2)
129
+ assert_equal 1, @builder.index(8,8)
130
+ assert_equal 3, @builder.index(9,3)
131
+ assert_equal 0, @builder.index(4,3)
132
+ assert_equal 0, @builder.index(0,2)
133
+ end
134
+
135
+ def test_to_adr_all_numbers
136
+ adr = [1, 2, 3]
137
+ exp = "[1][2][3]"
138
+ assert exp, @builder.to_adr(adr)
139
+ end
140
+
141
+ ##
142
+ # address object
143
+ #
144
+ def test_adr_obj
145
+ x = "awesome"
146
+ hsh = {1 => [{"k1" => x}]}
147
+ adr = [1, 0, "k1"]
148
+ act = @builder.adr_obj(hsh, adr)
149
+ assert_equal x, act
150
+ end
151
+
152
+ def test_to_adr_all_string
153
+ adr = ["k1", "k2"]
154
+ exp = "['k1']['k2']"
155
+ assert exp, @builder.to_adr(adr)
156
+ end
157
+
158
+ def test_to_adr_mixed
159
+ adr = ["k1", 1, 2, 3, "k2", 4]
160
+ exp = "['k1'][1][2][3]['k2'][4]"
161
+ assert exp, @builder.to_adr(adr)
162
+ end
163
+
164
+ def test_add_to_list
165
+ lst = {}
166
+ exp_lst1 = {1 => "k1"}
167
+ exp_lst2 = {1 => "k1", 2 => "k1,k2"}
168
+ exp_lst3 = {1 => "k1", 2 => "k1,k2", 3 => "string"}
169
+ @builder.add_to_list(lst, ["k1"])
170
+ assert_equal exp_lst1, lst
171
+ @builder.add_to_list(lst, ["k1","k2"])
172
+ assert_equal exp_lst2, lst
173
+ @builder.add_to_list(lst, "string")
174
+ assert_equal exp_lst3, lst
175
+ end
176
+
177
+ def test_update_index_greater_than_before
178
+ # index > length
179
+ idx = 5
180
+ adr = [1,2,3,4,5]
181
+ exp = "gt"
182
+ act = @builder.update(adr, idx)
183
+ assert_equal 5, adr.length
184
+ assert_equal exp, act
185
+ end
186
+
187
+ def test_update_index_same_as_before
188
+ # index == length; remain the same
189
+ idx = 4
190
+ adr = [1,2,3,4,5]
191
+ exp = "eq"
192
+ act = @builder.update(adr, idx)
193
+ assert_equal 5, adr.length
194
+ assert_equal exp, act
195
+ end
196
+
197
+ def test_update_index_less_than_before
198
+ # remain the same because 0 is the doc
199
+ idx = 3
200
+ adr = [1,2,3,4,5]
201
+ exp_msg = "lt"
202
+ exp_adr = [1,2,3,4]
203
+ act = @builder.update(adr, idx)
204
+ assert_equal 4, adr.length
205
+ assert_equal exp_msg, act
206
+ assert_equal exp_adr, adr
207
+ end
208
+
209
+ def test_update_zero_index
210
+ idx = 0
211
+ adr = [1,2,3,4,5]
212
+ exp_msg = "lt"
213
+ exp_adr = [1]
214
+ act = @builder.update(adr, idx)
215
+ assert_equal 1, adr.length
216
+ assert_equal exp_msg, act
217
+ assert_equal exp_adr, adr
218
+ end
219
+
220
+ def test_blank_line
221
+ hsh = {:lst => {}}
222
+ exp_lst1 = {1=>"#BLANK"}
223
+ exp_lst2 = {1=>"#BLANK",2=>"#BLANK"}
224
+ @builder.blank(hsh[:lst])
225
+ assert_equal exp_lst1, hsh[:lst]
226
+ @builder.blank(hsh[:lst])
227
+ assert_equal exp_lst2, hsh[:lst]
228
+ end
229
+
230
+ def test_doc_start
231
+ hsh = {}
232
+ exp_lst1 = {1=>"#DOC_START"}
233
+ exp_lst2 = {1=>"#DOC_START",2=>"#DOC_START"}
234
+ @builder.doc_start(hsh)
235
+ assert_equal exp_lst1, hsh[:lst]
236
+ @builder.doc_start(hsh)
237
+ assert_equal exp_lst2, hsh[:lst]
238
+ end
239
+
240
+ def test_doc_term
241
+ hsh = {:adr => [], :lst => {}}
242
+ exp_lst1 = {1 => "#DOC_TERM"}
243
+ exp_lst2 = {1 => "#DOC_TERM", 2 => "#DOC_TERM"}
244
+ @builder.doc_term(hsh)
245
+ assert_equal exp_lst1, hsh[:lst]
246
+ @builder.doc_term(hsh)
247
+ assert_equal exp_lst2, hsh[:lst]
248
+ end
249
+
250
+ def test_hashkey_into_hash
251
+ las = {}
252
+ adr = []
253
+ @builder.hsh_key(las, adr, "k1")
254
+ exp_las = {"k1" => {}}
255
+ exp_adr = ["k1"]
256
+ assert_equal exp_las, las
257
+ assert_equal exp_adr, adr
258
+ end
259
+
260
+ def test_hashkey_into_array
261
+ las = []
262
+ adr = []
263
+ @builder.hsh_key(las, adr, "k1")
264
+ exp_las = [{"k1" => {}}]
265
+ exp_adr = [0,"k1"]
266
+ assert_equal exp_las, las
267
+ assert_equal exp_adr, adr
268
+ end
269
+
270
+ def test_hashpair_into_hash
271
+ las = {}
272
+ exp1 = {"k1" => "awesome"}
273
+ exp2 = {"k1" => "awesome", "k2" => "dude"}
274
+ @builder.hsh_pair(las, "k1", "awesome")
275
+ assert_equal exp1, las
276
+ @builder.hsh_pair(las, "k2", "dude")
277
+ assert_equal exp2, las
278
+ end
279
+
280
+ def test_hashpair_into_array
281
+ las = []
282
+ exp1 = [{"k1" => "awesome"}]
283
+ exp2 = [{"k1" => "awesome"}, {"k2" => "dude"}]
284
+ @builder.hsh_pair(las, "k1", "awesome")
285
+ assert_equal exp1, las
286
+ @builder.hsh_pair(las, "k2", "dude")
287
+ assert_equal exp2, las
288
+ end
289
+
290
+ def test_comment
291
+ lst = {}
292
+ exp = {1 => "#COMMENT: awesome"}
293
+ @builder.comment(lst, "awesome")
294
+ assert_equal exp, lst
295
+ exp = {1 => "#COMMENT: awesome", 2 => "#COMMENT: dude"}
296
+ @builder.comment(lst, "dude")
297
+ assert_equal exp, lst
298
+ end
299
+
300
+ def test_array_into_hash
301
+ las = {}
302
+ adr = []
303
+ exp_las = {}
304
+ exp_adr = []
305
+ val = "awesome"
306
+ @builder.array_new(las, adr, val)
307
+ assert_equal exp_las, las
308
+ assert_equal exp_adr, adr
309
+ end
310
+
311
+ def test_array_into_array
312
+ las = [3]
313
+ adr = []
314
+ val = "awesome"
315
+ exp_las = [3,["awesome"]]
316
+ exp_adr = [1]
317
+ @builder.array_new(las, adr, val)
318
+ assert_equal exp_las, las
319
+ assert_equal exp_adr, adr
320
+ end
321
+
322
+ def test_add_value_to_array
323
+ las = []
324
+ adr = []
325
+ @builder.array_val(las, 1)
326
+ assert_equal [], adr
327
+ assert_equal [1], las
328
+ @builder.array_val(las, 2)
329
+ assert_equal [], adr
330
+ assert_equal [1,2], las
331
+ end
332
+
333
+ def test_malformed
334
+ lst = {}
335
+ exp = {1 => "#MALFORMED: string1"}
336
+ @builder.malformed(lst, "string1")
337
+ assert_equal exp, lst
338
+ exp = {1 => "#MALFORMED: string1", 2 => "#MALFORMED: string2"}
339
+ @builder.malformed(lst, "string2")
340
+ assert_equal exp, lst
341
+ end
342
+ end