Skip to content

Commit 7495721

Browse files
committed
Update all usages of attributes as proplists into maps
1 parent 47acef7 commit 7495721

File tree

7 files changed

+62
-76
lines changed

7 files changed

+62
-76
lines changed

include/exml.hrl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
style = escaped :: escaped | cdata}).
1111

1212
-record(xmlel, {name :: binary(),
13-
attrs = [] :: [exml:attr()],
13+
attrs = #{} :: exml:attrs(),
1414
children = [] :: [exml:element() | exml:cdata()]}).
1515

1616
%% Implementation of the exmlAssertEqual/2 macro is a modification of

include/exml_stream.hrl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-include("exml.hrl").
22

33
-record(xmlstreamstart, {name :: binary(),
4-
attrs = [] :: [exml:attr()]}).
4+
attrs = #{} :: exml:attrs()}).
55

66
-record(xmlstreamend, {name :: binary()}).

src/exml.erl

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@
2929
xml_sort/1]).
3030

3131
-export_type([attr/0,
32+
attrs/0,
3233
cdata/0,
3334
element/0,
3435
item/0]).
3536

3637
-type attr() :: {binary(), binary()}.
38+
-type attrs() :: #{binary() => binary()}.
3739
-type cdata() :: #xmlcdata{}.
3840
%% CDATA record. Printing escaping rules defaults to escaping character-wise.
3941
%%
@@ -57,13 +59,13 @@ xml_size(#xmlcdata{content = Content, style = Style}) ->
5759
iolist_size(exml_nif:escape_cdata(Content, Style));
5860
xml_size(#xmlel{ name = Name, attrs = Attrs, children = [] }) ->
5961
3 % Self-closing: </>
60-
+ byte_size(Name) + xml_size(Attrs);
62+
+ byte_size(Name) + xml_size(maps:to_list(Attrs));
6163
xml_size(#xmlel{ name = Name, attrs = Attrs, children = Children }) ->
6264
% Opening and closing: <></>
6365
5 + byte_size(Name)*2
64-
+ xml_size(Attrs) + xml_size(Children);
66+
+ xml_size(maps:to_list(Attrs)) + xml_size(Children);
6567
xml_size(#xmlstreamstart{ name = Name, attrs = Attrs }) ->
66-
byte_size(Name) + 2 + xml_size(Attrs);
68+
byte_size(Name) + 2 + xml_size(maps:to_list(Attrs));
6769
xml_size(#xmlstreamend{ name = Name }) ->
6870
byte_size(Name) + 3;
6971
xml_size({Key, Value}) when is_binary(Key) ->
@@ -91,13 +93,12 @@ xml_size({Key, Value}) when is_binary(Key) ->
9193
(exml_stream:stop()) -> exml_stream:stop().
9294
xml_sort(#xmlcdata{} = Cdata) ->
9395
Cdata;
94-
xml_sort(#xmlel{ attrs = Attrs, children = Children } = El) ->
96+
xml_sort(#xmlel{children = Children} = El) ->
9597
El#xmlel{
96-
attrs = lists:sort(Attrs),
9798
children = [ xml_sort(C) || C <- Children ]
9899
};
99-
xml_sort(#xmlstreamstart{ attrs = Attrs } = StreamStart) ->
100-
StreamStart#xmlstreamstart{ attrs = lists:sort(Attrs) };
100+
xml_sort(#xmlstreamstart{} = StreamStart) ->
101+
StreamStart;
101102
xml_sort(#xmlstreamend{} = StreamEnd) ->
102103
StreamEnd;
103104
xml_sort({Key, Value}) ->
@@ -121,8 +122,7 @@ remove_cdata(#xmlel{children = Children} = El) ->
121122
%% @doc Remove a given attribute from a `t:element/0'.
122123
-spec remove_attr(exml:element(), binary()) -> element().
123124
remove_attr(#xmlel{attrs = Attrs} = El, Key) ->
124-
NewAttrs = lists:keydelete(Key, 1, Attrs),
125-
El#xmlel{attrs = NewAttrs}.
125+
El#xmlel{attrs = maps:remove(Key, Attrs)}.
126126

127127
%% @doc Append new children elements to a `t:element/0'.
128128
-spec append_children(element(), [element() | cdata()]) -> element().
@@ -132,9 +132,7 @@ append_children(#xmlel{children = Children} = El, ExtraChildren) ->
132132
%% @doc Replace or insert the value of a given attribute.
133133
-spec upsert_attr_value(element(), binary(), binary()) -> element().
134134
upsert_attr_value(#xmlel{attrs = Attrs} = El, Key, Value) ->
135-
Attrs1 = lists:keydelete(Key, 1, Attrs),
136-
Attrs2 = [{Key, Value} | Attrs1],
137-
El#xmlel{attrs = Attrs2}.
135+
El#xmlel{attrs = Attrs#{Key => Value}}.
138136

139137
%% @doc Replace or insert a child by the given one.
140138
-spec upsert_child(element(), element()) -> element().

src/exml_query.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ paths(#xmlel{} = Element, [{element_with_attr, AttrName, Value} | Rest]) ->
116116
paths(#xmlel{} = Element, [cdata]) ->
117117
[cdata(Element)];
118118
paths(#xmlel{attrs = Attrs}, [{attr, Name}]) ->
119-
lists:sublist([V || {N, V} <- Attrs, N =:= Name], 1);
119+
lists:sublist([V || {N, V} <- maps:to_list(Attrs), N =:= Name], 1);
120120
paths(#xmlel{} = El, Path) when is_list(Path) ->
121121
erlang:error(invalid_path, [El, Path]).
122122

@@ -253,9 +253,9 @@ attr(Element, Name) ->
253253
%% @equiv path(Element, [{attr, Name}], Default)
254254
-spec attr(exml:element(), binary(), Default) -> binary() | Default.
255255
attr(#xmlel{attrs = Attrs}, Name, Default) ->
256-
case lists:keyfind(Name, 1, Attrs) of
257-
{Name, Value} ->
256+
case maps:find(Name, Attrs) of
257+
{ok, Value} ->
258258
Value;
259-
false ->
259+
error ->
260260
Default
261261
end.

test/exml_query_tests.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ element_with_name_and_ns_query_test() ->
132132
<<"urn:xmpp:chat-markers:0">>}])).
133133

134134
element_with_name_and_ns_two_names_only_one_ns_query_test() ->
135-
Elem1 = #xmlel{name = <<"a">>, attrs = [{<<"xmlns">>, <<"ns1">>}]},
136-
Elem2 = #xmlel{name = <<"a">>, attrs = [{<<"xmlns">>, <<"ns2">>}]},
135+
Elem1 = #xmlel{name = <<"a">>, attrs = #{<<"xmlns">> => <<"ns1">>}},
136+
Elem2 = #xmlel{name = <<"a">>, attrs = #{<<"xmlns">> => <<"ns2">>}},
137137
Xml = #xmlel{name = <<"element">>, children = [Elem1, Elem2]},
138138
?assertEqual(Elem2, exml_query:subelement_with_name_and_ns(Xml, <<"a">>, <<"ns2">>)),
139139
?assertEqual(Elem2, exml_query:path(Xml, [{element_with_ns, <<"a">>, <<"ns2">>}])).

test/exml_stream_tests.erl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ basic_parse_test() ->
1414
exml_stream:parse(Parser1, <<" to='i.am.banana.com' xml:lang='en'><auth">>),
1515
?assertEqual(
1616
[#xmlstreamstart{name = <<"stream:stream">>,
17-
attrs = [{<<"xmlns:stream">>, <<"http://etherx.jabber.org/streams">>},
18-
{<<"version">>, <<"1.0">>},
19-
{<<"to">>, <<"i.am.banana.com">>},
20-
{<<"xml:lang">>, <<"en">>}]}],
17+
attrs = #{<<"xmlns:stream">> => <<"http://etherx.jabber.org/streams">>,
18+
<<"version">> => <<"1.0">>,
19+
<<"to">> => <<"i.am.banana.com">>,
20+
<<"xml:lang">> => <<"en">>}}],
2121
StreamStart),
2222
{ok, Parser3, Auth} = exml_stream:parse(Parser2, <<" mechanism='DIGEST-MD5'/>">>),
2323
?assertEqual(
24-
[#xmlel{name = <<"auth">>, attrs = [{<<"mechanism">>, <<"DIGEST-MD5">>}]}],
24+
[#xmlel{name = <<"auth">>, attrs = #{<<"mechanism">> => <<"DIGEST-MD5">>}}],
2525
Auth),
2626
{ok, Parser4, Empty1} = exml_stream:parse(Parser3, <<"<stream:features><bind xmlns='some_ns'">>),
2727
?assertEqual([], Empty1),
@@ -31,9 +31,9 @@ basic_parse_test() ->
3131
?assertMatch(
3232
[#xmlel{name = <<"stream:features">>,
3333
children = [#xmlel{name = <<"bind">>,
34-
attrs = [{<<"xmlns">>, <<"some_ns">>}]},
34+
attrs = #{<<"xmlns">> := <<"some_ns">>}},
3535
#xmlel{name = <<"session">>,
36-
attrs = [{<<"xmlns">>, <<"some_other">>}]},
36+
attrs = #{<<"xmlns">> := <<"some_other">>}},
3737
_CData]}],
3838
Features),
3939
[#xmlel{children=[_, _, CData]}] = Features,
@@ -49,9 +49,9 @@ parser_errors_test() ->
4949
-define(BANANA_STREAM, <<"<stream:stream xmlns:stream='something'><foo attr='bar'>I am a banana!<baz/></foo></stream:stream>">>).
5050
-define(assertIsBanana(Elements), (fun() -> % fun instead of begin/end because we bind CData in unhygenic macro
5151
?assertMatch([#xmlstreamstart{name = <<"stream:stream">>,
52-
attrs = [{<<"xmlns:stream">>, <<"something">>}]},
52+
attrs = #{<<"xmlns:stream">> := <<"something">>}},
5353
#xmlel{name = <<"foo">>,
54-
attrs = [{<<"attr">>, <<"bar">>}],
54+
attrs = #{<<"attr">> := <<"bar">>},
5555
children = [_CData, #xmlel{name = <<"baz">>}]},
5656
#xmlstreamend{name = <<"stream:stream">>}],
5757
Elements),
@@ -84,12 +84,12 @@ infinit_framed_stream_test() ->
8484
{ok, Parser0} = exml_stream:new_parser([{infinite_stream, true},
8585
{autoreset, true}]),
8686
Els = [#xmlel{name = <<"open">>,
87-
attrs = [{<<"xmlns">>, <<"urn:ietf:params:xml:ns:xmpp-framing">>},
88-
{<<"to">>, <<"example.com">>},
89-
{<<"version">>, <<"1.0">>}]},
87+
attrs = #{<<"xmlns">> => <<"urn:ietf:params:xml:ns:xmpp-framing">>,
88+
<<"to">> => <<"example.com">>,
89+
<<"version">> => <<"1.0">>}},
9090
#xmlel{name = <<"foo">>},
9191
#xmlel{name = <<"message">>,
92-
attrs = [{<<"to">>, <<"[email protected]">>}],
92+
attrs = #{<<"to">> => <<"[email protected]">>},
9393
children = [#xmlel{name = <<"body">>,
9494
children = [#xmlcdata{content = <<"Hi, How Are You?">>}]}]}
9595
],
@@ -147,7 +147,7 @@ conv_attr_test() ->
147147
AssertParses = fun(Input) ->
148148
{ok, Parser0} = exml_stream:new_parser(),
149149
{ok, _Parser1, Elements} = exml_stream:parse(Parser0, Input),
150-
?assertMatch([_, #xmlel{attrs = [{<<"attr">>, <<"&<>\"'\n\t\r">>}]} | _],
150+
?assertMatch([_, #xmlel{attrs = #{<<"attr">> := <<"&<>\"'\n\t\r">>}} | _],
151151
Elements),
152152
Elements
153153
end,
@@ -233,18 +233,18 @@ infinite_stream_partial_chunk_test() ->
233233
{ok, Parser1, Open} = exml_stream:parse(Parser0, <<"<open xmlns='urn:ietf:params:xml:ns:xmpp-framing' to='i.am.banana.com' version='1.0'/>">>),
234234
?assertEqual(
235235
[#xmlel{name = <<"open">>,
236-
attrs = [{<<"xmlns">>, <<"urn:ietf:params:xml:ns:xmpp-framing">>},
237-
{<<"to">>, <<"i.am.banana.com">>},
238-
{<<"version">>, <<"1.0">>}]}],
236+
attrs = #{<<"xmlns">> => <<"urn:ietf:params:xml:ns:xmpp-framing">>,
237+
<<"to">> => <<"i.am.banana.com">>,
238+
<<"version">> => <<"1.0">>}}],
239239
Open),
240240
{ok, Parser2, A} = exml_stream:parse(Parser1, <<"<a></a>">>),
241-
?assertEqual([#xmlel{name = <<"a">>, attrs = []}], A),
241+
?assertEqual([#xmlel{name = <<"a">>, attrs = #{}}], A),
242242
{ok, Parser3, Empty0} = exml_stream:parse(Parser2, <<" ">>),
243243
?assertEqual([], Empty0),
244244
{ok, Parser4, Empty1} = exml_stream:parse(Parser3, <<"<b></b">>),
245245
?assertEqual([], Empty1),
246246
{ok, _Parser5, B} = exml_stream:parse(Parser4, <<">">>),
247-
?assertEqual([#xmlel{name = <<"b">>, attrs = []}], B).
247+
?assertEqual([#xmlel{name = <<"b">>, attrs = #{}}], B).
248248

249249
null_character_test() ->
250250
{ok, P1} = exml_stream:new_parser(),

test/exml_tests.erl

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ size_of_exml_with_cdata_test() ->
4747
sort_xmlel_identity_test() ->
4848
El = #xmlel{
4949
name = <<"foo">>,
50-
attrs = [{<<"attr1">>, <<"bar">>}],
50+
attrs = #{<<"attr1">> => <<"bar">>},
5151
children = [#xmlcdata{ content = <<"some value">> }]
5252
},
5353
?assertEqual(El, exml:xml_sort(El)).
@@ -58,7 +58,7 @@ sort_xmlel_attributes_test() ->
5858
?assertEqual(Attrs, exml:xml_sort(ToOrder)).
5959

6060
remove_cdata_test() ->
61-
Attrs = [{<<"attr1">>, <<"foo">>}, {<<"attr2">>, <<"bar">>}],
61+
Attrs = #{<<"attr1">> => <<"foo">>, <<"attr2">> => <<"bar">>},
6262
Child1 = #xmlel{name = <<"el1">>, attrs = Attrs},
6363
Child2 = #xmlel{name = <<"el2">>, attrs = Attrs},
6464
CData = #xmlcdata{content = <<"some value">>},
@@ -67,17 +67,17 @@ remove_cdata_test() ->
6767
?exmlAssertEqual(Expected, exml:remove_cdata(El)).
6868

6969
filter_children_test() ->
70-
Attrs = [{<<"attr1">>, <<"foo">>}, {<<"attr2">>, <<"bar">>}],
71-
Child1 = #xmlel{name = <<"el1">>, attrs = [{<<"xmlns">>, <<"foo">>}]},
72-
Child2 = #xmlel{name = <<"el2">>, attrs = [{<<"xmlns">>, <<"bar">>} | Attrs]},
73-
Child3 = #xmlel{name = <<"el3">>, attrs = [{<<"xmlns">>, <<"baz">>} | Attrs]},
70+
Attrs = #{<<"attr1">> => <<"foo">>, <<"attr2">> => <<"bar">>},
71+
Child1 = #xmlel{name = <<"el1">>, attrs = #{<<"xmlns">> => <<"foo">>}},
72+
Child2 = #xmlel{name = <<"el2">>, attrs = maps:merge(#{<<"xmlns">> => <<"bar">>}, Attrs)},
73+
Child3 = #xmlel{name = <<"el3">>, attrs = maps:merge(#{<<"xmlns">> => <<"baz">>}, Attrs)},
7474
El = #xmlel{name = <<"foo">>, children = [Child1, Child2, Child3]},
7575
Expected = #xmlel{name = <<"foo">>, children = [Child1, Child3]},
7676
Pred = fun(Child) -> <<"bar">> =/= exml_query:attr(Child, <<"xmlns">>) end,
7777
?exmlAssertEqual(Expected, exml:filter_children(El, Pred)).
7878

7979
append_children_test() ->
80-
Attrs = [{<<"attr1">>, <<"foo">>}, {<<"attr2">>, <<"bar">>}],
80+
Attrs = #{<<"attr1">> => <<"foo">>, <<"attr2">> => <<"bar">>},
8181
Child1 = #xmlel{name = <<"el1">>, attrs = Attrs},
8282
Child2 = #xmlel{name = <<"el2">>, attrs = Attrs},
8383
CData = #xmlcdata{content = <<"some value">>},
@@ -86,21 +86,21 @@ append_children_test() ->
8686
?exmlAssertEqual(Expected, exml:append_children(El, [Child2, CData])).
8787

8888
replace_attribute_value_test() ->
89-
Attrs1 = [{<<"attr1">>, <<"foo">>}, {<<"attr2">>, <<"bar">>}],
90-
Attrs2 = [{<<"attr1">>, <<"foo">>}, {<<"attr2">>, <<"baz">>}],
89+
Attrs1 = #{<<"attr1">> => <<"foo">>, <<"attr2">> => <<"bar">>},
90+
Attrs2 = #{<<"attr1">> => <<"foo">>, <<"attr2">> => <<"baz">>},
9191
El = #xmlel{name = <<"foo">>, attrs = Attrs1},
9292
Expected = #xmlel{name = <<"foo">>, attrs = Attrs2},
9393
?exmlAssertEqual(Expected, exml:upsert_attr_value(El, <<"attr2">>, <<"baz">>)).
9494

9595
remove_attribute_test() ->
96-
Attrs1 = [{<<"attr1">>, <<"foo">>}, {<<"attr2">>, <<"bar">>}],
97-
Attrs2 = [{<<"attr2">>, <<"bar">>}],
96+
Attrs1 = #{<<"attr1">> => <<"foo">>, <<"attr2">> => <<"bar">>},
97+
Attrs2 = #{<<"attr2">> => <<"bar">>},
9898
El = #xmlel{name = <<"foo">>, attrs = Attrs1},
9999
Expected = #xmlel{name = <<"foo">>, attrs = Attrs2},
100100
?exmlAssertEqual(Expected, exml:remove_attr(El, <<"attr1">>)).
101101

102102
replace_child_test() ->
103-
Attrs = [{<<"attr1">>, <<"foo">>}, {<<"attr2">>, <<"bar">>}],
103+
Attrs = #{<<"attr1">> => <<"foo">>, <<"attr2">> => <<"bar">>},
104104
Child1 = #xmlel{name = <<"el">>},
105105
Child2 = #xmlel{name = <<"el">>, attrs = Attrs},
106106
Child3 = #xmlel{name = <<"last">>, attrs = Attrs, children = [Child1]},
@@ -109,27 +109,16 @@ replace_child_test() ->
109109
?exmlAssertEqual(Expected, exml:upsert_child(El, Child2)).
110110

111111
insert_new_child_test() ->
112-
Attrs = [{<<"attr1">>, <<"foo">>}, {<<"attr2">>, <<"bar">>}],
112+
Attrs = #{<<"attr1">> => <<"foo">>, <<"attr2">> => <<"bar">>},
113113
Child1 = #xmlel{name = <<"el">>},
114114
Child2 = #xmlel{name = <<"el">>, attrs = Attrs},
115115
Child3 = #xmlel{name = <<"last">>, attrs = Attrs, children = [Child1]},
116116
El = #xmlel{name = <<"foo">>, children = [Child1, Child3]},
117117
Expected = #xmlel{name = <<"foo">>, children = [Child1, Child3]},
118118
?exmlAssertEqual(Expected, exml:insert_new_child(El, Child2)).
119119

120-
sort_xmlel_test() ->
121-
Attrs = [{<<"attr1">>, <<"bar">>}, {<<"attr2">>, <<"baz">>}],
122-
El1 = #xmlel{
123-
name = <<"foo">>,
124-
attrs = Attrs,
125-
children = [#xmlcdata{ content = <<"some value">> }]
126-
},
127-
El2 = El1#xmlel{ attrs = lists:reverse(Attrs) },
128-
?assertNotEqual(El1, El2),
129-
?assertEqual(exml:xml_sort(El1), exml:xml_sort(El2)).
130-
131120
sort_xmlel_nested_test() ->
132-
Attrs = [{<<"attr1">>, <<"bar">>}, {<<"attr2">>, <<"baz">>}],
121+
Attrs = #{<<"attr1">> => <<"bar">>, <<"attr2">> => <<"baz">>},
133122
CData = [#xmlcdata{ content = <<"some value">> }],
134123
Nested1 = #xmlel{
135124
name = <<"n1">>,
@@ -138,7 +127,7 @@ sort_xmlel_nested_test() ->
138127
},
139128
Nested2 = #xmlel{
140129
name = <<"n2">>,
141-
attrs = lists:reverse(Attrs),
130+
attrs = Attrs,
142131
children = CData
143132
},
144133
Children = [Nested1, Nested2],
@@ -152,10 +141,9 @@ sort_xmlel_nested_test() ->
152141
?assertNotEqual(exml:xml_sort(El1), exml:xml_sort(El2)).
153142

154143
sort_xmlstreamstart_test() ->
155-
Attrs = [{<<"attr1">>, <<"bar">>}, {<<"attr2">>, <<"baz">>}],
144+
Attrs = #{<<"attr1">> => <<"bar">>, <<"attr2">> => <<"baz">>},
156145
SS1 = #xmlstreamstart{name = <<"n1">>, attrs = Attrs},
157-
SS2 = SS1#xmlstreamstart{attrs = lists:reverse(Attrs)},
158-
?assertNotEqual(SS1, SS2),
146+
SS2 = SS1#xmlstreamstart{attrs = Attrs},
159147
?assertEqual(exml:xml_sort(SS1), exml:xml_sort(SS2)).
160148

161149
sort_xmlstreamend_test() ->
@@ -167,7 +155,7 @@ sort_xmlstreamend_test() ->
167155
sort_xmlel_list_test() ->
168156
El1 = #xmlel{
169157
name = <<"foo">>,
170-
attrs = [{<<"attr1">>, <<"bar">>}],
158+
attrs = #{<<"attr1">> => <<"bar">>},
171159
children = [#xmlcdata{ content = <<"some value">> }]
172160
},
173161
El2 = El1#xmlel{ name = <<"baz">> },
@@ -177,22 +165,22 @@ sort_xmlel_list_test() ->
177165
?assertEqual(exml:xml_sort(L1), exml:xml_sort(L2)).
178166

179167
assert_xmlel_equal_macro_positive_test() ->
180-
Attrs = [{<<"attr1">>, <<"bar">>}, {<<"attr2">>, <<"baz">>}],
168+
Attrs = #{<<"attr1">> => <<"bar">>, <<"attr2">> => <<"baz">>},
181169
El1 = #xmlel{
182170
name = <<"foo">>,
183171
attrs = Attrs,
184-
children = [#xmlcdata{ content = <<"some value">> }]
172+
children = [#xmlcdata{content = <<"some value">>}]
185173
},
186-
El2 = El1#xmlel{ attrs = lists:reverse(Attrs) },
174+
El2 = El1#xmlel{attrs = Attrs},
187175
?exmlAssertEqual(El1, El2).
188176

189177
assert_xmlel_equal_macro_negative_test() ->
190178
El1 = #xmlel{
191179
name = <<"foo">>,
192-
attrs = [{<<"attr1">>, <<"bar">>}, {<<"attr2">>, <<"baz">>}],
193-
children = [#xmlcdata{ content = <<"some value">> }]
180+
attrs = #{<<"attr1">> => <<"bar">>, <<"attr2">> => <<"baz">>},
181+
children = [#xmlcdata{content = <<"some value">>}]
194182
},
195-
El2 = El1#xmlel{ attrs = [] },
183+
El2 = El1#xmlel{attrs = #{}},
196184
?assertError({exmlAssertEqual, [_, _, _, {expected, El1}, {value, El2}]},
197185
?exmlAssertEqual(El1, El2)).
198186

@@ -203,7 +191,7 @@ throws_error_when_record_is_invalid_test() ->
203191
to_binary_arbitrary_stream_elements_test() ->
204192
Elements = [#xmlcdata{content = <<"content">>},
205193
#xmlstreamend{name = <<"endname">>},
206-
#xmlstreamstart{name = <<"name">>, attrs = [{<<"a">>, <<"b">>}]}],
194+
#xmlstreamstart{name = <<"name">>, attrs = #{<<"a">> => <<"b">>}}],
207195
?assertEqual(<<"content</endname><name a='b'>">>, exml:to_binary(Elements)).
208196

209197
parse(Doc) ->

0 commit comments

Comments
 (0)