Skip to content

Commit

Permalink
Fix tests on OTP 26
Browse files Browse the repository at this point in the history
  • Loading branch information
michalmuskala committed Jul 7, 2023
1 parent 6e299d5 commit 01386f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/encode_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ defmodule Jason.EncoderTest do

test "Fragment" do
pre_encoded_json = Jason.encode!(%{hello: "world", test: 123})
assert to_json(%{foo: Jason.Fragment.new(pre_encoded_json)}) == ~s({"foo":{"hello":"world","test":123}})
assert to_json(%{foo: Jason.Fragment.new(pre_encoded_json)}) == ~s({"foo":#{pre_encoded_json}})
end

defmodule Derived do
Expand Down Expand Up @@ -190,7 +190,7 @@ defmodule Jason.EncoderTest do
def encode(struct, opts) do
struct
|> Map.from_struct
|> Enum.map(&(&1))
|> Enum.sort_by(&elem(&1, 0))
|> Jason.Encode.keyword(opts)
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/helpers_test.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Jason.HelpersTest do
use ExUnit.Case, async: true

alias Jason.{Helpers, Fragment, EncodeError}
alias Jason.{OrderedObject, Helpers, Fragment, EncodeError}
import Helpers

doctest Helpers
Expand All @@ -17,7 +17,7 @@ defmodule Jason.HelpersTest do

test "produces same output as regular encoding" do
assert %Fragment{} = helper = json_map(bar: 2, baz: 3, foo: 1)
assert Jason.encode!(helper) == Jason.encode!(%{bar: 2, baz: 3, foo: 1})
assert Jason.encode!(helper) == Jason.encode!(OrderedObject.new(bar: 2, baz: 3, foo: 1))
end

test "rejects keys with invalid characters" do
Expand Down

0 comments on commit 01386f9

Please sign in to comment.