Skip to content

Commit 5a923ce

Browse files
fendormergify[bot]
andauthored
Make sure running tests locally pick up the correct cradle type (#3869)
* Run golden tests for "add argument" in temporary directory If developers have a local `hie.yaml` for HLS development, this causes the tests to pick up said `hie.yaml`. This causes these tests to use a cabal cradle, slowing down the test execution. Should have no effect on CI, though, which never has a `hie.yaml` in the root of the project. * Remove redundant CPP statement --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent a19ccaf commit 5a923ce

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

plugins/hls-refactor-plugin/test/Main.hs

-5
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,7 @@ codeActionTests = testGroup "code actions"
325325
, exportUnusedTests
326326
, addImplicitParamsConstraintTests
327327
, removeExportTests
328-
#if MIN_VERSION_ghc(9,2,1)
329328
, Test.AddArgument.tests
330-
#endif
331329
]
332330

333331
insertImportTests :: TestTree
@@ -2222,9 +2220,6 @@ insertNewDefinitionTests = testGroup "insert new definition actions"
22222220
++ txtB')
22232221
]
22242222

2225-
#if MIN_VERSION_ghc(9,2,1)
2226-
#endif
2227-
22282223
deleteUnusedDefinitionTests :: TestTree
22292224
deleteUnusedDefinitionTests = testGroup "delete unused definition action"
22302225
[ testSession "delete unused top level binding" $

plugins/hls-refactor-plugin/test/Test/AddArgument.hs

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ import Test.Tasty.HUnit
2222

2323

2424
import Test.Hls
25+
import qualified Test.Hls.FileSystem as FS
2526

2627
import qualified Development.IDE.Plugin.CodeAction as Refactor
28+
import System.FilePath ((<.>))
2729

2830
tests :: TestTree
2931
tests =
@@ -63,11 +65,11 @@ mkGoldenAddArgTest' testFileName range varName = do
6365
<$> getCodeActions docB range
6466
liftIO $ actionTitle @?= ("Add argument ‘" <> varName <> "’ to function")
6567
executeCodeAction action
66-
goldenWithHaskellDoc
68+
goldenWithHaskellDocInTmpDir
6769
def
6870
(mkPluginTestDescriptor Refactor.bindingsPluginDescriptor "ghcide-code-actions-bindings")
6971
(testFileName <> " (golden)")
70-
"test/data/golden/add-arg"
72+
(FS.mkVirtualFileTree "test/data/golden/add-arg" (FS.directProject $ testFileName <.> "hs"))
7173
testFileName
7274
"expected"
7375
"hs"

0 commit comments

Comments
 (0)