Skip to content

Commit

Permalink
Merge pull request #15 from GPrimola/update-yaml-elixir
Browse files Browse the repository at this point in the history
Update yaml elixir
  • Loading branch information
GPrimola authored Feb 15, 2024
2 parents 91cbcf1 + a20be18 commit 660d9bf
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 15 deletions.
4 changes: 1 addition & 3 deletions .dialyzer_ignore.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
[
{":0:unknown_type Unknown type: YamlElixir.ParsingError.t/0."}
]
[]
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ defmodule Yamel.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:yaml_elixir, "~> 2.4.0"},
{:yaml_elixir, "~> 2.8.0"},
{:ex_doc, ">= 0.0.0", runtime: false, only: :dev},
{:excoveralls, "~> 0.13.2", only: :test},
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false}
Expand Down
4 changes: 2 additions & 2 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.5.0", "8516502659002cec19e244ebd90d312183064be95025a319a6c7e89f4bccd65b", [:rebar3], [], "hexpm", "d48d002e15f5cc105a696cf2f1bbb3fc72b4b770a184d8420c8db20da2674b38"},
"yamerl": {:hex, :yamerl, "0.8.0", "8214cfe16bbabe5d1d6c14a14aea11c784b9a21903dd6a7c74f8ce180adae5c7", [:rebar3], [], "hexpm", "010634477bf9c208a0767dcca89116c2442cf0b5e87f9c870f85cd1c3e0c2aab"},
"yaml_elixir": {:hex, :yaml_elixir, "2.4.0", "2f444abc3c994c902851fde56b6a9cb82895c291c05a0490a289035c2e62ae71", [:mix], [{:yamerl, "~> 0.7", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm", "4e25a6d5c873e393689c6f1062c5ec90f6cd1be2527b073178ae37eae4c78bee"},
"yamerl": {:hex, :yamerl, "0.10.0", "4ff81fee2f1f6a46f1700c0d880b24d193ddb74bd14ef42cb0bcf46e81ef2f8e", [:rebar3], [], "hexpm", "346adb2963f1051dc837a2364e4acf6eb7d80097c0f53cbdc3046ec8ec4b4e6e"},
"yaml_elixir": {:hex, :yaml_elixir, "2.8.0", "c7ff0034daf57279c2ce902788ce6fdb2445532eb4317e8df4b044209fae6832", [:mix], [{:yamerl, "~> 0.8", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm", "4b674bd881e373d1ac6a790c64b2ecb69d1fd612c2af3b22de1619c15473830b"},
}
37 changes: 29 additions & 8 deletions test/yamel/io_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ defmodule Yamel.IOTest do
end

test "should raise ? with an invalid YAML file" do
assert_raise(YamlElixir.ParsingError, "malformed yaml", fn ->
Yamel.IO.read!(@invalid_yml)
end)
assert_raise(
YamlElixir.ParsingError,
"Unexpected \"yamerl_collection_start\" token following a \"yamerl_collection_end\" token (line: 3, column: 1)",
fn ->
Yamel.IO.read!(@invalid_yml)
end
)
end
end

Expand All @@ -30,7 +34,14 @@ defmodule Yamel.IOTest do

test "should return {:error, reason} with an invalid YAML file" do
assert {:error, reason} = Yamel.IO.read(@invalid_yml)
assert %YamlElixir.ParsingError{message: "malformed yaml"} = reason

assert %YamlElixir.ParsingError{
column: 1,
line: 3,
message:
"Unexpected \"yamerl_collection_start\" token following a \"yamerl_collection_end\" token",
type: :unexpected_token
} = reason
end
end

Expand All @@ -51,7 +62,15 @@ defmodule Yamel.IOTest do

yaml_path = "test/fixtures/test.yaml"
refute File.exists?(yaml_path)
assert {:error, %{message: "malformed yaml"}} = Yamel.IO.write(yaml, yaml_path)

assert {:error,
%YamlElixir.ParsingError{
column: 13,
line: 1,
message: "Block mapping value not allowed here",
type: :block_mapping_value_not_allowed
}} = Yamel.IO.write(yaml, yaml_path)

refute File.exists?(yaml_path)
end
end
Expand All @@ -74,9 +93,11 @@ defmodule Yamel.IOTest do
yaml_path = "test/fixtures/test.yaml"
refute File.exists?(yaml_path)

assert_raise YamlElixir.ParsingError, "malformed yaml", fn ->
Yamel.IO.write!(yaml, yaml_path)
end
assert_raise YamlElixir.ParsingError,
"Block mapping value not allowed here (line: 1, column: 13)",
fn ->
Yamel.IO.write!(yaml, yaml_path)
end

refute File.exists?(yaml_path)
end
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.2
1.2.1

0 comments on commit 660d9bf

Please sign in to comment.