Skip to content

Commit

Permalink
fix mistak
Browse files Browse the repository at this point in the history
  • Loading branch information
mruoss committed Oct 18, 2023
1 parent bcc8acd commit b335bef
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/ymlr/encode_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ defmodule Ymlr.EncodeTest do
test "quoted strings - escape seq forces double quotes (tab char)" do
assert_encode("a\tb", ~s("a\tb"))
assert_encode("!a\tb", ~s("!a\tb"))
assert_encode(~S(@a\nb), ~s('@a\\nb'))
# Not for explicit backslash:
assert_encode(~S(!a\tb), ~S('!a\tb'))
end

test "quoted strings - listy and mappy things" do
Expand All @@ -112,7 +113,7 @@ defmodule Ymlr.EncodeTest do

test "bitstrings" do
assert_raise Protocol.UndefinedError, ~r/cannot encode a bitstring to YAML/, fn ->
assert MUT.to_s!(<<3::4>>)
MUT.to_s!(<<3::4>>)
end
end

Expand Down Expand Up @@ -150,8 +151,10 @@ defmodule Ymlr.EncodeTest do
end

test "hex and oversize float" do
assert MUT.to_s!("7e0981ff4c0daa3a47db5542ad5c167176145ef65f597a7f94ba2f5b41d35718") ==
"7e0981ff4c0daa3a47db5542ad5c167176145ef65f597a7f94ba2f5b41d35718"
assert_encode(
"7e0981ff4c0daa3a47db5542ad5c167176145ef65f597a7f94ba2f5b41d35718",
"7e0981ff4c0daa3a47db5542ad5c167176145ef65f597a7f94ba2f5b41d35718"
)

assert_encode("1.7976931348623157e+309", "1.7976931348623157e+309")
end
Expand Down Expand Up @@ -191,7 +194,7 @@ defmodule Ymlr.EncodeTest do

test "invalid map key" do
assert_raise ArgumentError, fn ->
assert MUT.to_s!(%{%{a: 1} => 2})
MUT.to_s!(%{%{a: 1} => 2})
end
end

Expand Down Expand Up @@ -280,8 +283,8 @@ defmodule Ymlr.EncodeTest do

test "nested: map / map" do
result =
assert MUT.to_s!(%{a: %{b: 1, c: %{d: 2}}, e: %{f: 3, g: 4}})
|> YamlElixir.read_from_string!()
MUT.to_s!(%{a: %{b: 1, c: %{d: 2}}, e: %{f: 3, g: 4}})
|> YamlElixir.read_from_string!()

assert 2 == result["a"]["c"]["d"]
assert 1 == result["a"]["b"]
Expand Down Expand Up @@ -342,7 +345,6 @@ defmodule Ymlr.EncodeTest do
}
"""

# not working yet => TODO better handling of terminal newlines
assert YamlElixir.read_from_string!(encoded) == given
# assert encoded == expected
assert encoded == expected <> " "
Expand Down

0 comments on commit b335bef

Please sign in to comment.