@@ -126,9 +126,22 @@ init_per_testcase(TestCase, Config) when TestCase =:= gradualizer ->
126
126
els_test_utils :init_per_testcase (TestCase , Config );
127
127
init_per_testcase (TestCase , Config ) when TestCase =:= sheldon ->
128
128
meck :new (els_sheldon_diagnostics , [passthrough , no_link ]),
129
- meck :expect (els_sheldon_diagnostics , is_default , 0 , true ),
130
- els_mock_diagnostics :setup (),
131
- els_test_utils :init_per_testcase (TestCase , Config );
129
+ case list_to_integer (erlang :system_info (otp_release )) >= 23 of
130
+ true ->
131
+ meck :expect (els_sheldon_diagnostics , is_default , 0 , true ),
132
+ els_mock_diagnostics :setup (),
133
+ meck :expect ( els_diagnostics_provider
134
+ , init
135
+ , fun () ->
136
+ DiagnosticsConfig = #{" enabled" => [<<" sheldon" >>]},
137
+ els_config :set (diagnostics , DiagnosticsConfig ),
138
+ meck :passthrough ([])
139
+ end
140
+ ),
141
+ els_test_utils :init_per_testcase (TestCase , Config );
142
+ false ->
143
+ {skip , " Sheldon diagnostics should run on OTP23+" }
144
+ end ;
132
145
init_per_testcase (TestCase , Config ) ->
133
146
els_mock_diagnostics :setup (),
134
147
els_test_utils :init_per_testcase (TestCase , Config ).
@@ -667,38 +680,33 @@ gradualizer(_Config) ->
667
680
668
681
-spec sheldon (config ()) -> ok .
669
682
sheldon (_Config ) ->
670
- case list_to_integer (erlang :system_info (otp_release )) >= 23 of
671
- true ->
672
- {ok , Cwd } = file :get_cwd (),
673
- RootPath = els_test_utils :root_path (),
674
- try
675
- file :set_cwd (RootPath ),
676
- Path = src_path (" diagnostics_sheldon.erl" ),
677
- Source = <<" Sheldon" >>,
678
- Errors = [],
679
- Warnings = [ #{ code => spellcheck
680
- , message => <<" The word \" sheldon\" in "
681
- " comment is unknown. "
682
- " Maybe you wanted to use \" Sheldon\" ?" >>
683
- , range => {{2 , 0 }, {3 , 0 }}
684
- , relatedInformation => []
685
- }
686
- , #{ code => spellcheck
687
- , message => <<" The word \" somestrange\" in comment is "
688
- " unknown." >>
689
- , range => {{0 , 0 }, {1 , 0 }}
690
- , relatedInformation => []
691
- }
692
- ],
693
- Hints = [],
694
- els_test :run_diagnostics_test (Path , Source , Errors , Warnings , Hints )
695
- catch _Err ->
696
- file :set_cwd (Cwd )
697
- end ,
698
- ok ;
699
- false ->
700
- {skipped , " Sheldon diagnostics should run on OTP23+" }
701
- end .
683
+ {ok , Cwd } = file :get_cwd (),
684
+ RootPath = els_test_utils :root_path (),
685
+ try
686
+ file :set_cwd (RootPath ),
687
+ Path = src_path (" diagnostics_sheldon.erl" ),
688
+ Source = <<" Sheldon" >>,
689
+ Errors = [],
690
+ Warnings = [ #{ code => spellcheck
691
+ , message => <<" The word \" sheldon\" in "
692
+ " comment is unknown. "
693
+ " Maybe you wanted to use \" Sheldon\" ?" >>
694
+ , range => {{2 , 0 }, {3 , 0 }}
695
+ , relatedInformation => []
696
+ }
697
+ , #{ code => spellcheck
698
+ , message => <<" The word \" somestrange\" in comment is "
699
+ " unknown." >>
700
+ , range => {{0 , 0 }, {1 , 0 }}
701
+ , relatedInformation => []
702
+ }
703
+ ],
704
+ Hints = [],
705
+ els_test :run_diagnostics_test (Path , Source , Errors , Warnings , Hints )
706
+ catch _Err ->
707
+ file :set_cwd (Cwd )
708
+ end ,
709
+ ok .
702
710
703
711
% %==============================================================================
704
712
% % Internal Functions
0 commit comments