Skip to content

Commit 4d52d18

Browse files
committed
Do not reset column state in tests
1 parent 39ff86c commit 4d52d18

File tree

3 files changed

+35
-40
lines changed

3 files changed

+35
-40
lines changed

lib/eex/test/eex_test.exs

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -761,38 +761,31 @@ defmodule EExTest do
761761
end
762762

763763
test "line and column meta" do
764-
parser_options = Code.get_compiler_option(:parser_options)
765-
Code.put_compiler_option(:parser_options, columns: true)
766-
767-
try do
768-
indentation = 12
769-
770-
ast =
771-
EEx.compile_string(
772-
"""
773-
<%= f() %> <% f() %>
774-
<%= f fn -> %>
775-
<%= f() %>
776-
<% end %>
777-
""",
778-
indentation: indentation
779-
)
780-
781-
{_, calls} =
782-
Macro.prewalk(ast, [], fn
783-
{:f, meta, _args} = expr, acc -> {expr, [meta | acc]}
784-
other, acc -> {other, acc}
785-
end)
786-
787-
assert Enum.reverse(calls) == [
788-
[line: 1, column: indentation + 5],
789-
[line: 1, column: indentation + 15],
790-
[line: 2, column: indentation + 7],
791-
[line: 3, column: indentation + 9]
792-
]
793-
after
794-
Code.put_compiler_option(:parser_options, parser_options)
795-
end
764+
indentation = 12
765+
766+
ast =
767+
EEx.compile_string(
768+
"""
769+
<%= f() %> <% f() %>
770+
<%= f fn -> %>
771+
<%= f() %>
772+
<% end %>
773+
""",
774+
indentation: indentation
775+
)
776+
777+
{_, calls} =
778+
Macro.prewalk(ast, [], fn
779+
{:f, meta, _args} = expr, acc -> {expr, [meta | acc]}
780+
other, acc -> {other, acc}
781+
end)
782+
783+
assert Enum.reverse(calls) == [
784+
[line: 1, column: indentation + 5],
785+
[line: 1, column: indentation + 15],
786+
[line: 2, column: indentation + 7],
787+
[line: 3, column: indentation + 9]
788+
]
796789
end
797790
end
798791

lib/elixir/test/elixir/kernel/parallel_compiler_test.exs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ defmodule Kernel.ParallelCompilerTest do
147147
expected_msg = "Undef.__struct__/1 is undefined, cannot expand struct Undef"
148148

149149
assert capture_io(:stderr, fn ->
150-
assert {:error, [{^fixture, 3, msg}, {^fixture, 0, compile_msg}], []} =
150+
assert {:error, [{^fixture, {3, 5}, msg}, {^fixture, 0, compile_msg}], []} =
151151
Kernel.ParallelCompiler.compile([fixture])
152152

153153
assert msg =~ expected_msg
@@ -216,7 +216,7 @@ defmodule Kernel.ParallelCompilerTest do
216216
"ThisModuleWillNeverBeAvailable.__struct__/1 is undefined, cannot expand struct ThisModuleWillNeverBeAvailable"
217217

218218
assert capture_io(:stderr, fn ->
219-
assert {:error, [{^fixture, 7, msg}, {^fixture, 0, compile_msg}], []} =
219+
assert {:error, [{^fixture, {7, 3}, msg}, {^fixture, 0, compile_msg}], []} =
220220
Kernel.ParallelCompiler.compile([fixture])
221221

222222
assert msg =~ expected_msg
@@ -245,7 +245,9 @@ defmodule Kernel.ParallelCompilerTest do
245245
"ThisModuleWillNeverBeAvailable.__struct__/1 is undefined, cannot expand struct ThisModuleWillNeverBeAvailable"
246246

247247
assert capture_io(:stderr, fn ->
248-
assert {:error, [{^missing_struct, 2, msg}, {^missing_struct, 0, compile_msg}], []} =
248+
assert {:error,
249+
[{^missing_struct, {2, 3}, msg}, {^missing_struct, 0, compile_msg}],
250+
[]} =
249251
Kernel.ParallelCompiler.compile([missing_struct, depends_on])
250252

251253
assert msg =~ expected_msg
@@ -272,7 +274,9 @@ defmodule Kernel.ParallelCompilerTest do
272274
expected_msg = "module Unknown.Module is not loaded and could not be found"
273275

274276
assert capture_io(:stderr, fn ->
275-
assert {:error, [{^missing_import, 2, msg}, {^missing_import, 0, compile_msg}], []} =
277+
assert {:error,
278+
[{^missing_import, {2, 3}, msg}, {^missing_import, 0, compile_msg}],
279+
[]} =
276280
Kernel.ParallelCompiler.compile([missing_import, depends_on])
277281

278282
assert msg =~ expected_msg
@@ -509,7 +513,7 @@ defmodule Kernel.ParallelCompilerTest do
509513
expected_msg = "Undef.__struct__/1 is undefined, cannot expand struct Undef"
510514

511515
assert capture_io(:stderr, fn ->
512-
assert {:error, [{^fixture, 3, msg}, {^fixture, 0, compile_msg}], []} =
516+
assert {:error, [{^fixture, {3, 5}, msg}, {^fixture, 0, compile_msg}], []} =
513517
Kernel.ParallelCompiler.require([fixture])
514518

515519
assert msg =~ expected_msg
@@ -537,7 +541,7 @@ defmodule Kernel.ParallelCompilerTest do
537541
"ThisModuleWillNeverBeAvailable.__struct__/1 is undefined, cannot expand struct ThisModuleWillNeverBeAvailable"
538542

539543
assert capture_io(:stderr, fn ->
540-
assert {:error, [{^fixture, 7, msg}, {^fixture, 0, compile_msg}], []} =
544+
assert {:error, [{^fixture, {7, 3}, msg}, {^fixture, 0, compile_msg}], []} =
541545
Kernel.ParallelCompiler.require([fixture])
542546

543547
assert msg =~ expected_msg

lib/elixir/test/elixir/kernel/tracers_test.exs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ defmodule Kernel.TracersTest do
1616

1717
setup_all do
1818
Code.put_compiler_option(:tracers, [__MODULE__])
19-
Code.put_compiler_option(:parser_options, columns: true)
2019

2120
on_exit(fn ->
2221
Code.put_compiler_option(:tracers, [])
23-
Code.put_compiler_option(:parser_options, [])
2422
end)
2523
end
2624

0 commit comments

Comments
 (0)