File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ defimpl Inspect, for: Atom do
100
100
valid_ref_identifier? ( binary ) ->
101
101
"Elixir." <> rest = binary
102
102
rest
103
- atom in [ :{} , :<<>> ] ->
103
+ atom in [ :{} , :<<>> , :... ] ->
104
104
":" <> binary
105
105
atom in Macro . binary_ops or atom in Macro . unary_ops ->
106
106
":" <> binary
@@ -127,16 +127,21 @@ defimpl Inspect, for: Atom do
127
127
# Detect if atom
128
128
129
129
defp valid_atom_identifier? ( << h , t :: binary >> ) when h in ?a .. ?z or h in ?A .. ?Z or h == ?_ do
130
- case valid_identifier? ( t ) do
131
- << >> -> true
132
- << ?? >> -> true
133
- << ?! >> -> true
134
- _ -> false
135
- end
130
+ valid_atom_piece? ( t )
136
131
end
137
132
138
133
defp valid_atom_identifier? ( _ ) , do: false
139
134
135
+ defp valid_atom_piece? ( t ) do
136
+ case valid_identifier? ( t ) do
137
+ << >> -> true
138
+ << ?? >> -> true
139
+ << ?! >> -> true
140
+ << ?@ , t :: binary >> -> valid_atom_piece? ( t )
141
+ _ -> false
142
+ end
143
+ end
144
+
140
145
defp valid_identifier? ( << h , t :: binary >> )
141
146
when h in ?a .. ?z
142
147
when h in ?A .. ?Z
Original file line number Diff line number Diff line change @@ -37,11 +37,22 @@ defmodule Inspect.AtomTest do
37
37
end
38
38
39
39
test :op do
40
- assert inspect ( :@ ) == ":@ "
40
+ assert inspect ( :+ ) == ":+ "
41
41
assert inspect ( :&&& ) == ":&&&"
42
42
assert inspect ( :~~~ ) == ":~~~"
43
43
end
44
44
45
+ test :... do
46
+ assert inspect ( :... ) == ":..."
47
+ end
48
+
49
+ test :@ do
50
+ assert inspect ( :@ ) == ":@"
51
+ assert inspect ( :foo@bar ) == ":foo@bar"
52
+ assert inspect ( :foo@bar@ ) == ":foo@bar@"
53
+ assert inspect ( :foo@bar@baz ) == ":foo@bar@baz"
54
+ end
55
+
45
56
test :container do
46
57
assert inspect ( :<<>> ) == ":<<>>"
47
58
assert inspect ( :{} ) == ":{}"
You can’t perform that action at this time.
0 commit comments