Skip to content

Commit 132756a

Browse files
committed
format with elixir 1.15
1 parent cc46f87 commit 132756a

File tree

4 files changed

+40
-40
lines changed

4 files changed

+40
-40
lines changed

apps/elixir_ls_debugger/test/variables_test.exs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ defmodule ElixirLS.Debugger.VariablesTest do
3737

3838
assert Variables.type([]) == "list"
3939
assert Variables.type([1]) == "list"
40-
assert Variables.type('asd') == "list"
40+
assert Variables.type(~c"asd") == "list"
4141

4242
assert Variables.type(abc: 123) == "keyword"
4343

@@ -90,7 +90,7 @@ defmodule ElixirLS.Debugger.VariablesTest do
9090

9191
assert Variables.num_children([]) == 0
9292
assert Variables.num_children([1]) == 1
93-
assert Variables.num_children('asd') == 3
93+
assert Variables.num_children(~c"asd") == 3
9494

9595
assert Variables.num_children(abc: 123) == 1
9696

@@ -108,7 +108,7 @@ defmodule ElixirLS.Debugger.VariablesTest do
108108
assert Variables.children([1], 0, 10) == [{"0", 1}]
109109
assert Variables.children([1, 2, 3, 4], 0, 2) == [{"0", 1}, {"1", 2}]
110110
assert Variables.children([1, 2, 3, 4], 1, 2) == [{"1", 2}, {"2", 3}]
111-
assert Variables.children('asd', 0, 10) == [{"0", 97}, {"1", 115}, {"2", 100}]
111+
assert Variables.children(~c"asd", 0, 10) == [{"0", 97}, {"1", 115}, {"2", 100}]
112112
end
113113

114114
test "keyword" do
@@ -195,10 +195,10 @@ defmodule ElixirLS.Debugger.VariablesTest do
195195

196196
case :os.type() do
197197
{:win32, _} ->
198-
assert children[:name] == '2/2'
198+
assert children[:name] == ~c"2/2"
199199

200200
_ ->
201-
assert children[:name] == 'forker'
201+
assert children[:name] == ~c"forker"
202202
end
203203
end
204204
end

apps/elixir_ls_utils/test/output_device_test.exs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ defmodule ElixirLS.Utils.OutputDeviceTest do
161161
end
162162
end
163163

164-
def get_chars_list("abc"), do: 'some'
164+
def get_chars_list("abc"), do: ~c"some"
165165
def get_chars_binary("abc"), do: "some"
166166
def get_chars_invalid("abc"), do: :some
167167
def get_chars_raise("abc"), do: raise(ArgumentError)
@@ -241,7 +241,7 @@ defmodule ElixirLS.Utils.OutputDeviceTest do
241241
test "unicode list", %{
242242
output_device: output_device
243243
} do
244-
request = {:put_chars, :unicode, 'sąme👨‍👩‍👦'}
244+
request = {:put_chars, :unicode, ~c"sąme👨‍👩‍👦"}
245245
send(output_device, {:io_request, self(), 123, request})
246246
assert_receive({:io_reply, 123, :ok})
247247

@@ -261,7 +261,7 @@ defmodule ElixirLS.Utils.OutputDeviceTest do
261261
test "latin1 list", %{
262262
output_device: output_device
263263
} do
264-
request = {:put_chars, :latin1, 'some'}
264+
request = {:put_chars, :latin1, ~c"some"}
265265
send(output_device, {:io_request, self(), 123, request})
266266
assert_receive({:io_reply, 123, :ok})
267267

@@ -271,7 +271,7 @@ defmodule ElixirLS.Utils.OutputDeviceTest do
271271
test "latin1 list with chars > 255", %{
272272
output_device: output_device
273273
} do
274-
request = {:put_chars, :latin1, 'sąme👨‍👩‍👦'}
274+
request = {:put_chars, :latin1, ~c"sąme👨‍👩‍👦"}
275275
send(output_device, {:io_request, self(), 123, request})
276276
assert_receive({:io_reply, 123, {:error, :put_chars}})
277277

apps/language_server/lib/language_server/cli.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ defmodule ElixirLS.LanguageServer.CLI do
8181
{:ok, _} ->
8282
:ok
8383

84-
{:error, {:edoc, {'no such file or directory', 'edoc.app'}}} ->
84+
{:error, {:edoc, {~c"no such file or directory", ~c"edoc.app"}}} ->
8585
message = incomplete_installation_message("#edoc-missing")
8686

8787
JsonRpc.show_message(:error, message)
8888
Process.sleep(5000)
8989
raise message
9090

91-
{:error, {:dialyzer, {'no such file or directory', 'dialyzer.app'}}} ->
91+
{:error, {:dialyzer, {~c"no such file or directory", ~c"dialyzer.app"}}} ->
9292
message = incomplete_installation_message("#dialyzer-missing")
9393

9494
JsonRpc.show_message(:error, message)

apps/language_server/test/providers/code_lens/type_spec/contract_translator_test.exs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ defmodule ElixirLS.LanguageServer.Providers.CodeLens.TypeSpec.ContractTranslator
33
alias ElixirLS.LanguageServer.Providers.CodeLens.TypeSpec.ContractTranslator
44

55
test "translate struct when struct.t type exists" do
6-
contract = '() -> \#{\'__struct__\':=\'Elixir.DateTime\'}'
6+
contract = ~c"() -> \#{'__struct__':='Elixir.DateTime'}"
77

88
assert "foo :: DateTime.t()" ==
99
ContractTranslator.translate_contract(:foo, contract, false, Atom)
1010
end
1111

1212
test "don't translate struct when struct.t type does not exist" do
13-
contract = '() -> \#{\'__struct__\':=\'Elixir.SomeOtherStruct\'}'
13+
contract = ~c"() -> \#{'__struct__':='Elixir.SomeOtherStruct'}"
1414

1515
assert "foo :: %SomeOtherStruct{}" ==
1616
ContractTranslator.translate_contract(:foo, contract, false, Atom)
1717
end
1818

1919
test "struct" do
20-
contract = '() -> \#{\'__struct__\':=atom(), atom()=>any()}'
20+
contract = ~c"() -> \#{'__struct__':=atom(), atom()=>any()}"
2121
assert "foo :: struct" == ContractTranslator.translate_contract(:foo, contract, false, Atom)
2222
end
2323

2424
test "drop macro env argument" do
25-
contract = '(any(), integer()) -> integer()'
25+
contract = ~c"(any(), integer()) -> integer()"
2626

2727
assert "foo(any, integer) :: integer" ==
2828
ContractTranslator.translate_contract(:foo, contract, false, Atom)
@@ -32,119 +32,119 @@ defmodule ElixirLS.LanguageServer.Providers.CodeLens.TypeSpec.ContractTranslator
3232
end
3333

3434
test "atom :ok" do
35-
contract = '(any()) -> ok'
35+
contract = ~c"(any()) -> ok"
3636
assert "foo(any) :: :ok" == ContractTranslator.translate_contract(:foo, contract, false, Atom)
3737
end
3838

3939
test "atom true" do
40-
contract = '(any()) -> true'
40+
contract = ~c"(any()) -> true"
4141

4242
assert "foo(any) :: true" ==
4343
ContractTranslator.translate_contract(:foo, contract, false, Atom)
4444
end
4545

4646
test "atom _ substitution" do
47-
contract = '(_) -> false'
47+
contract = ~c"(_) -> false"
4848

4949
assert "foo(any) :: false" ==
5050
ContractTranslator.translate_contract(:foo, contract, false, Atom)
5151
end
5252

5353
test "do not drop when substitutions" do
54-
contract = '(X) -> atom() when X :: any()'
54+
contract = ~c"(X) -> atom() when X :: any()"
5555

5656
assert "foo(x) :: atom when x: any" ==
5757
ContractTranslator.translate_contract(:foo, contract, false, Atom)
5858
end
5959

6060
test "keyword" do
61-
contract = '(any()) -> list({atom(), any()})'
61+
contract = ~c"(any()) -> list({atom(), any()})"
6262

6363
assert "foo(any) :: keyword" ==
6464
ContractTranslator.translate_contract(:foo, contract, false, Atom)
6565

66-
contract = '(any()) -> list({atom(), _})'
66+
contract = ~c"(any()) -> list({atom(), _})"
6767

6868
assert "foo(any) :: keyword" ==
6969
ContractTranslator.translate_contract(:foo, contract, false, Atom)
7070
end
7171

7272
test "keyword(t)" do
73-
contract = '(any()) -> list({atom(), integer()})'
73+
contract = ~c"(any()) -> list({atom(), integer()})"
7474

7575
assert "foo(any) :: keyword(integer)" ==
7676
ContractTranslator.translate_contract(:foo, contract, false, Atom)
7777
end
7878

7979
test "[type]" do
80-
contract = '(any()) -> list(atom())'
80+
contract = ~c"(any()) -> list(atom())"
8181

8282
assert "foo(any) :: [atom]" ==
8383
ContractTranslator.translate_contract(:foo, contract, false, Atom)
8484
end
8585

8686
test "list" do
87-
contract = '(any()) -> list(any())'
87+
contract = ~c"(any()) -> list(any())"
8888

8989
assert "foo(any) :: list" ==
9090
ContractTranslator.translate_contract(:foo, contract, false, Atom)
9191
end
9292

9393
test "empty list" do
94-
contract = '(any()) -> []'
94+
contract = ~c"(any()) -> []"
9595
assert "foo(any) :: []" == ContractTranslator.translate_contract(:foo, contract, false, Atom)
9696
end
9797

9898
test "[...]" do
99-
contract = '(any()) -> nonempty_list(any())'
99+
contract = ~c"(any()) -> nonempty_list(any())"
100100

101101
assert "foo(any) :: [...]" ==
102102
ContractTranslator.translate_contract(:foo, contract, false, Atom)
103103

104-
contract = '(any()) -> nonempty_list(_)'
104+
contract = ~c"(any()) -> nonempty_list(_)"
105105

106106
assert "foo(any) :: [...]" ==
107107
ContractTranslator.translate_contract(:foo, contract, false, Atom)
108108
end
109109

110110
test "[type, ...]" do
111-
contract = '(any()) -> nonempty_list(atom())'
111+
contract = ~c"(any()) -> nonempty_list(atom())"
112112

113113
assert "foo(any) :: [atom, ...]" ==
114114
ContractTranslator.translate_contract(:foo, contract, false, Atom)
115115
end
116116

117117
test "undoes conversion of :_ to any inside bitstring" do
118-
contract = '(any()) -> <<_:2, _:_*3>>'
118+
contract = ~c"(any()) -> <<_:2, _:_*3>>"
119119

120120
assert "foo(any) :: <<_::2, _::_*3>>" ==
121121
ContractTranslator.translate_contract(:foo, contract, false, Atom)
122122
end
123123

124124
test "function" do
125-
contract = '(any()) -> fun((...) -> ok)'
125+
contract = ~c"(any()) -> fun((...) -> ok)"
126126

127127
assert "foo(any) :: (... -> :ok)" ==
128128
ContractTranslator.translate_contract(:foo, contract, false, Atom)
129129
end
130130

131131
test "fun" do
132-
contract = '(any()) -> fun((...) -> any())'
132+
contract = ~c"(any()) -> fun((...) -> any())"
133133
assert "foo(any) :: fun" == ContractTranslator.translate_contract(:foo, contract, false, Atom)
134134
end
135135

136136
test "empty map" do
137-
contract = '(any()) -> \#{}'
137+
contract = ~c"(any()) -> \#{}"
138138
assert "foo(any) :: %{}" == ContractTranslator.translate_contract(:foo, contract, false, Atom)
139139
end
140140

141141
test "map" do
142-
contract = '(any()) -> \#{any()=>any()}'
142+
contract = ~c"(any()) -> \#{any()=>any()}"
143143
assert "foo(any) :: map" == ContractTranslator.translate_contract(:foo, contract, false, Atom)
144144
end
145145

146146
test "map with fields" do
147-
contract = '(any()) -> \#{integer()=>any(), 1:=atom(), abc:=4}'
147+
contract = ~c"(any()) -> \#{integer()=>any(), 1:=atom(), abc:=4}"
148148

149149
expected =
150150
if Version.match?(System.version(), "< 1.13.0") do
@@ -158,32 +158,32 @@ defmodule ElixirLS.LanguageServer.Providers.CodeLens.TypeSpec.ContractTranslator
158158
end
159159

160160
test "defprotocol type t" do
161-
contract = '(any()) -> any()'
161+
contract = ~c"(any()) -> any()"
162162

163163
assert "foo(t) :: any" ==
164164
ContractTranslator.translate_contract(:foo, contract, false, Enumerable)
165165

166-
contract = '(any(), any()) -> any()'
166+
contract = ~c"(any(), any()) -> any()"
167167

168168
assert "foo(t, any) :: any" ==
169169
ContractTranslator.translate_contract(:foo, contract, false, Enumerable)
170170

171-
contract = '(any()) -> any()'
171+
contract = ~c"(any()) -> any()"
172172
assert "foo(any) :: any" == ContractTranslator.translate_contract(:foo, contract, false, Atom)
173173

174-
contract = '(any(), any()) -> any()'
174+
contract = ~c"(any(), any()) -> any()"
175175

176176
assert "foo(any, any) :: any" ==
177177
ContractTranslator.translate_contract(:foo, contract, false, Atom)
178178
end
179179

180180
test "defimpl first arg" do
181-
contract = '(any()) -> any()'
181+
contract = ~c"(any()) -> any()"
182182

183183
assert "count(list) :: any" ==
184184
ContractTranslator.translate_contract(:count, contract, false, Enumerable.List)
185185

186-
contract = '(any()) -> any()'
186+
contract = ~c"(any()) -> any()"
187187

188188
assert "count(Date.Range.t()) :: any" ==
189189
ContractTranslator.translate_contract(:count, contract, false, Enumerable.Date.Range)

0 commit comments

Comments
 (0)