File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
test/elixir/code_formatter Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -553,6 +553,10 @@ defmodule Code.Formatter do
553
553
if keyword_key? ( left_arg ) do
554
554
{ left , state } =
555
555
case left_arg do
556
+ # TODO: Remove this clause in v1.16 when we no longer quote operator :..//
557
+ { :__block__ , _ , [ :"..//" ] } ->
558
+ { string ( ~S{ "..//":} ) , state }
559
+
556
560
{ :__block__ , _ , [ atom ] } when is_atom ( atom ) ->
557
561
key =
558
562
case Code.Identifier . classify ( atom ) do
@@ -1533,6 +1537,11 @@ defmodule Code.Formatter do
1533
1537
Atom . to_string ( atom )
1534
1538
end
1535
1539
1540
+ # TODO: Remove this clause in v1.16 when we no longer quote operator :..//
1541
+ defp atom_to_algebra ( :"..//" ) do
1542
+ string ( ":\" ..//\" " )
1543
+ end
1544
+
1536
1545
defp atom_to_algebra ( atom ) do
1537
1546
string = Atom . to_string ( atom )
1538
1547
Original file line number Diff line number Diff line change @@ -107,6 +107,14 @@ defmodule Code.Formatter.LiteralsTest do
107
107
assert_format ~S[ :"++"] , ~S[ :++]
108
108
end
109
109
110
+ test "quoted operators" do
111
+ assert_same ~S[ :"::"]
112
+ assert_same ~S[ :"..//"]
113
+ assert_format ~S[ :..//] , ~S[ :"..//"]
114
+ assert_format ~S{ [..//: 1]} , ~S{ ["..//": 1]}
115
+ assert_same ~S{ ["..//": 1]}
116
+ end
117
+
110
118
test "uses double quotes even when single quotes are used" do
111
119
assert_format ~S[ :'foo bar'] , ~S[ :"foo bar"]
112
120
end
You can’t perform that action at this time.
0 commit comments