Skip to content

Commit

Permalink
fix empty list test
Browse files Browse the repository at this point in the history
  • Loading branch information
mruoss committed Oct 17, 2023
1 parent a5c4918 commit 06497d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/ymlr/encode.ex
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ defmodule Ymlr.Encode do
end

@spec list(data :: list(), indent_level :: integer, opts :: Encoder.opts()) :: iodata()
def list([], indent_level, _), do: "[]"

def list(data, indent_level, opts) do
indentation = indent(indent_level)

Expand Down
2 changes: 1 addition & 1 deletion test/ymlr/encode_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ defmodule Ymlr.EncodeTest do
end

test "lists" do
assert_encode([], "")
assert_encode([], "[]")
assert_encode([1], "- 1")
assert_encode([""], ~s(- ""))
assert_encode([1, nil, 2], "- 1\n-\n- 2")
Expand Down

0 comments on commit 06497d7

Please sign in to comment.