|
1 | 1 | defmodule ElixirLS.LanguageServer.SourceFile.InvalidProjectTest do
|
2 |
| - |
3 | 2 | use ExUnit.Case, async: false
|
4 | 3 |
|
5 | 4 | use Patch
|
6 | 5 | alias ElixirLS.LanguageServer.SourceFile
|
7 | 6 | import ExUnit.CaptureIO
|
8 | 7 |
|
9 | 8 | describe "formatter_for " do
|
10 |
| - |
11 | 9 | test "should handle syntax errors" do
|
12 |
| - patch(Mix.Tasks.Format, :formatter_for_file, fn _ -> raise %SyntaxError{file: ".formatter.exs", line: 1} end) |
13 |
| - |
14 |
| - output = capture_io(:stderr, fn -> |
15 |
| - assert :error = SourceFile.formatter_for("file:///root.ex") |
| 10 | + patch(Mix.Tasks.Format, :formatter_for_file, fn _ -> |
| 11 | + raise %SyntaxError{file: ".formatter.exs", line: 1} |
16 | 12 | end)
|
17 | 13 |
|
| 14 | + output = |
| 15 | + capture_io(:stderr, fn -> |
| 16 | + assert :error = SourceFile.formatter_for("file:///root.ex") |
| 17 | + end) |
| 18 | + |
18 | 19 | assert String.contains?(output, "Unable to get formatter options")
|
19 | 20 | end
|
20 | 21 |
|
21 | 22 | test "should handle compile errors" do
|
22 |
| - patch(Mix.Tasks.Format, :formatter_for_file, fn _ -> raise %SyntaxError{file: ".formatter.exs", line: 1} end) |
23 |
| - |
24 |
| - output = capture_io(:stderr, fn -> |
25 |
| - assert :error = SourceFile.formatter_for("file:///root.ex") |
| 23 | + patch(Mix.Tasks.Format, :formatter_for_file, fn _ -> |
| 24 | + raise %SyntaxError{file: ".formatter.exs", line: 1} |
26 | 25 | end)
|
27 | 26 |
|
| 27 | + output = |
| 28 | + capture_io(:stderr, fn -> |
| 29 | + assert :error = SourceFile.formatter_for("file:///root.ex") |
| 30 | + end) |
| 31 | + |
28 | 32 | assert String.contains?(output, "Unable to get formatter options")
|
29 | 33 | end
|
30 |
| - |
31 | 34 | end
|
32 | 35 | end
|
0 commit comments