Skip to content

Commit

Permalink
Make sure running tests locally pick up the correct cradle type (#3869)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
fendor and mergify[bot] authored Nov 15, 2023
1 parent a19ccaf commit 5a923ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 0 additions & 5 deletions plugins/hls-refactor-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,7 @@ codeActionTests = testGroup "code actions"
, exportUnusedTests
, addImplicitParamsConstraintTests
, removeExportTests
#if MIN_VERSION_ghc(9,2,1)
, Test.AddArgument.tests
#endif
]

insertImportTests :: TestTree
Expand Down Expand Up @@ -2222,9 +2220,6 @@ insertNewDefinitionTests = testGroup "insert new definition actions"
++ txtB')
]

#if MIN_VERSION_ghc(9,2,1)
#endif

deleteUnusedDefinitionTests :: TestTree
deleteUnusedDefinitionTests = testGroup "delete unused definition action"
[ testSession "delete unused top level binding" $
Expand Down
6 changes: 4 additions & 2 deletions plugins/hls-refactor-plugin/test/Test/AddArgument.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ import Test.Tasty.HUnit


import Test.Hls
import qualified Test.Hls.FileSystem as FS

import qualified Development.IDE.Plugin.CodeAction as Refactor
import System.FilePath ((<.>))

tests :: TestTree
tests =
Expand Down Expand Up @@ -63,11 +65,11 @@ mkGoldenAddArgTest' testFileName range varName = do
<$> getCodeActions docB range
liftIO $ actionTitle @?= ("Add argument ‘" <> varName <> "’ to function")
executeCodeAction action
goldenWithHaskellDoc
goldenWithHaskellDocInTmpDir
def
(mkPluginTestDescriptor Refactor.bindingsPluginDescriptor "ghcide-code-actions-bindings")
(testFileName <> " (golden)")
"test/data/golden/add-arg"
(FS.mkVirtualFileTree "test/data/golden/add-arg" (FS.directProject $ testFileName <.> "hs"))
testFileName
"expected"
"hs"
Expand Down

0 comments on commit 5a923ce

Please sign in to comment.