From 48c2ee072c8950f367120fa1ae292b5034c9b6dd Mon Sep 17 00:00:00 2001 From: Fendor Date: Tue, 14 Nov 2023 16:07:46 +0100 Subject: [PATCH 1/2] 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. --- plugins/hls-refactor-plugin/test/Test/AddArgument.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/hls-refactor-plugin/test/Test/AddArgument.hs b/plugins/hls-refactor-plugin/test/Test/AddArgument.hs index 0d16e5be19..1198cea038 100644 --- a/plugins/hls-refactor-plugin/test/Test/AddArgument.hs +++ b/plugins/hls-refactor-plugin/test/Test/AddArgument.hs @@ -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 = @@ -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" From 2334073dac27f5110aa378ee567b90d67bd517cb Mon Sep 17 00:00:00 2001 From: Fendor Date: Tue, 14 Nov 2023 16:28:29 +0100 Subject: [PATCH 2/2] Remove redundant CPP statement --- plugins/hls-refactor-plugin/test/Main.hs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/plugins/hls-refactor-plugin/test/Main.hs b/plugins/hls-refactor-plugin/test/Main.hs index e7975e21fa..e9520804e9 100644 --- a/plugins/hls-refactor-plugin/test/Main.hs +++ b/plugins/hls-refactor-plugin/test/Main.hs @@ -325,9 +325,7 @@ codeActionTests = testGroup "code actions" , exportUnusedTests , addImplicitParamsConstraintTests , removeExportTests -#if MIN_VERSION_ghc(9,2,1) , Test.AddArgument.tests -#endif ] insertImportTests :: TestTree @@ -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" $