Skip to content

Commit

Permalink
Run Sheldon tests only for OTP 23+
Browse files Browse the repository at this point in the history
  • Loading branch information
vkatsuba committed Dec 1, 2021
1 parent 2230790 commit 79f3cac
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
-module(diagnostics_sheldon).

%% Trigger some "somestrange" warnings

%% Trigger some "sheldon" warnings
-module(diagnostics_sheldon).
54 changes: 30 additions & 24 deletions apps/els_lsp/test/els_diagnostics_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -667,30 +667,36 @@ gradualizer(_Config) ->

-spec sheldon(config()) -> ok.
sheldon(_Config) ->
{ok, Cwd} = file:get_cwd(),
RootPath = els_test_utils:root_path(),
try
file:set_cwd(RootPath),
Path = src_path("diagnostics_sheldon.erl"),
Source = <<"Sheldon">>,
Errors = [],
Warnings = [ #{ code => spellcheck
, message => <<"The word \"sheldon\" in comment is unknown"
". Maybe you wanted to use \"Sheldon\"?">>
, range => {{4, 0}, {5, 0}}
, relatedInformation => []
}
, #{ code => spellcheck
, message => <<"The word \"somestrange\" in comment is "
"unknown.">>
, range => {{2, 0}, {3, 0}}
, relatedInformation => []
}
],
Hints = [],
els_test:run_diagnostics_test(Path, Source, Errors, Warnings, Hints)
catch _Err ->
file:set_cwd(Cwd)
case list_to_integer(erlang:system_info(otp_release)) >= 23 of
true ->
{ok, Cwd} = file:get_cwd(),
RootPath = els_test_utils:root_path(),
try
file:set_cwd(RootPath),
Path = src_path("diagnostics_sheldon.erl"),
Source = <<"Sheldon">>,
Errors = [],
Warnings = [ #{ code => spellcheck
, message => <<"The word \"sheldon\" in "
"comment is unknown. "
"Maybe you wanted to use \"Sheldon\"?">>
, range => {{2, 0}, {3, 0}}
, relatedInformation => []
}
, #{ code => spellcheck
, message => <<"The word \"somestrange\" in comment is "
"unknown.">>
, range => {{0, 0}, {1, 0}}
, relatedInformation => []
}
],
Hints = [],
els_test:run_diagnostics_test(Path, Source, Errors, Warnings, Hints)
catch _Err ->
file:set_cwd(Cwd)
end;
false ->
ok
end,
ok.

Expand Down

0 comments on commit 79f3cac

Please sign in to comment.