@@ -629,41 +629,43 @@ defmodule Code.Normalizer.QuotedASTTest do
629629 assert quoted_to_string ( quote ( do: foo |> [ bar: :baz ] ) ) == "foo |> [bar: :baz]"
630630 end
631631
632- test "keyword arg edge case: cursor" do
632+ test "keyword arg with cursor" do
633633 input = "def foo, do: :bar, __cursor__()"
634634 expected = "def foo, [{:do, :bar}, __cursor__()]"
635635
636636 ast = Code . string_to_quoted! ( input )
637+ assert quoted_to_string ( ast ) == expected
637638
639+ encoder = & { :ok , { :__block__ , & 2 , [ & 1 ] } }
640+ ast = Code . string_to_quoted! ( input , literal_encoder: encoder )
638641 assert quoted_to_string ( ast ) == expected
639642
640- ast =
641- Code . string_to_quoted! ( input ,
642- literal_encoder: & { :ok , { :__block__ , & 2 , [ & 1 ] } }
643- )
643+ ast = Code . string_to_quoted! ( input , token_metadata: true )
644+ assert quoted_to_string ( ast ) == expected
644645
646+ ast = Code . string_to_quoted! ( input , literal_encoder: encoder , token_metadata: true )
645647 assert quoted_to_string ( ast ) == expected
646648 end
647649
648- test "keyword arg edge case: literal encoder " do
650+ test "keyword arg with tokenizer options " do
649651 input = """
650652 foo(Bar) do
651653 :ok
652- end
654+ end\
653655 """
654656
655- expected = String . trim ( input )
656-
657657 ast = Code . string_to_quoted! ( input )
658+ assert quoted_to_string ( ast ) == input
658659
659- assert quoted_to_string ( ast ) == expected
660+ encoder = & { :ok , { :__block__ , & 2 , [ & 1 ] } }
661+ ast = Code . string_to_quoted! ( input , literal_encoder: encoder )
662+ assert quoted_to_string ( ast ) == input
660663
661- ast =
662- Code . string_to_quoted! ( input ,
663- literal_encoder: & { :ok , { :__block__ , & 2 , [ & 1 ] } }
664- )
664+ ast = Code . string_to_quoted! ( input , token_metadata: true )
665+ assert quoted_to_string ( ast ) == input
665666
666- assert quoted_to_string ( ast ) == expected
667+ ast = Code . string_to_quoted! ( input , literal_encoder: encoder , token_metadata: true )
668+ assert quoted_to_string ( ast ) == input
667669 end
668670
669671 test "list in module attribute" do
0 commit comments