diff --git a/test/functional/Format.hs b/test/functional/Format.hs index 92955ead68..e0202c87f8 100644 --- a/test/functional/Format.hs +++ b/test/functional/Format.hs @@ -18,11 +18,11 @@ import qualified Data.Text.IO as T tests :: TestTree tests = testGroup "format document" [ - goldenVsStringDiff "works" goldenGitDiff "test/testdata/Format.formatted_document.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + goldenVsStringDiff "works" goldenGitDiff "test/testdata/format/Format.formatted_document.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do doc <- openDoc "Format.hs" "haskell" formatDoc doc (FormattingOptions 2 True) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "works with custom tab size" goldenGitDiff "test/testdata/Format.formatted_document_with_tabsize.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + , goldenVsStringDiff "works with custom tab size" goldenGitDiff "test/testdata/format/Format.formatted_document_with_tabsize.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do doc <- openDoc "Format.hs" "haskell" formatDoc doc (FormattingOptions 5 True) BS.fromStrict . T.encodeUtf8 <$> documentContents doc @@ -38,11 +38,11 @@ tests = testGroup "format document" [ rangeTests :: TestTree rangeTests = testGroup "format range" [ - goldenVsStringDiff "works" goldenGitDiff "test/testdata/Format.formatted_range.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + goldenVsStringDiff "works" goldenGitDiff "test/testdata/format/Format.formatted_range.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do doc <- openDoc "Format.hs" "haskell" formatRange doc (FormattingOptions 2 True) (Range (Position 5 0) (Position 7 10)) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "works with custom tab size" goldenGitDiff "test/testdata/Format.formatted_range_with_tabsize.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + , goldenVsStringDiff "works with custom tab size" goldenGitDiff "test/testdata/format/Format.formatted_range_with_tabsize.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do doc <- openDoc "Format.hs" "haskell" formatRange doc (FormattingOptions 5 True) (Range (Position 8 0) (Position 11 19)) BS.fromStrict . T.encodeUtf8 <$> documentContents doc @@ -50,7 +50,7 @@ rangeTests = testGroup "format range" [ providerTests :: TestTree providerTests = testGroup "formatting provider" [ - testCase "respects none" $ runSessionWithConfig (formatConfig "none") hlsCommand fullCaps "test/testdata" $ do + testCase "respects none" $ runSessionWithConfig (formatConfig "none") hlsCommand fullCaps "test/testdata/format" $ do doc <- openDoc "Format.hs" "haskell" orig <- documentContents doc @@ -61,10 +61,10 @@ providerTests = testGroup "formatting provider" [ documentContents doc >>= liftIO . (@?= orig) #if AGPL - , testCase "can change on the fly" $ runSession hlsCommand fullCaps "test/testdata" $ do - formattedBrittany <- liftIO $ T.readFile "test/testdata/Format.brittany.formatted.hs" - formattedFloskell <- liftIO $ T.readFile "test/testdata/Format.floskell.formatted.hs" - formattedBrittanyPostFloskell <- liftIO $ T.readFile "test/testdata/Format.brittany_post_floskell.formatted.hs" + , testCase "can change on the fly" $ runSession hlsCommand fullCaps "test/testdata/format" $ do + formattedBrittany <- liftIO $ T.readFile "test/testdata/format/Format.brittany.formatted.hs" + formattedFloskell <- liftIO $ T.readFile "test/testdata/format/Format.floskell.formatted.hs" + formattedBrittanyPostFloskell <- liftIO $ T.readFile "test/testdata/format/Format.brittany_post_floskell.formatted.hs" doc <- openDoc "Format.hs" "haskell" @@ -79,9 +79,9 @@ providerTests = testGroup "formatting provider" [ sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "brittany")) formatDoc doc (FormattingOptions 2 True) documentContents doc >>= liftIO . (@?= formattedBrittanyPostFloskell) - , testCase "supports both new and old configuration sections" $ runSession hlsCommand fullCaps "test/testdata" $ do - formattedBrittany <- liftIO $ T.readFile "test/testdata/Format.brittany.formatted.hs" - formattedFloskell <- liftIO $ T.readFile "test/testdata/Format.floskell.formatted.hs" + , testCase "supports both new and old configuration sections" $ runSession hlsCommand fullCaps "test/testdata/format" $ do + formattedBrittany <- liftIO $ T.readFile "test/testdata/format/Format.brittany.formatted.hs" + formattedFloskell <- liftIO $ T.readFile "test/testdata/format/Format.floskell.formatted.hs" doc <- openDoc "Format.hs" "haskell" @@ -97,12 +97,12 @@ providerTests = testGroup "formatting provider" [ stylishHaskellTests :: TestTree stylishHaskellTests = testGroup "stylish-haskell" [ - goldenVsStringDiff "formats a document" goldenGitDiff "test/testdata/StylishHaksell.formatted_document.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + goldenVsStringDiff "formats a document" goldenGitDiff "test/testdata/format/StylishHaskell.formatted_document.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "stylish-haskell")) doc <- openDoc "StylishHaskell.hs" "haskell" formatDoc doc (FormattingOptions 2 True) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "formats a range" goldenGitDiff "test/testdata/StylishHaksell.formatted_range.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + , goldenVsStringDiff "formats a range" goldenGitDiff "test/testdata/format/StylishHaskell.formatted_range.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "stylish-haskell")) doc <- openDoc "StylishHaskell.hs" "haskell" formatRange doc (FormattingOptions 2 True) (Range (Position 0 0) (Position 2 21)) @@ -112,26 +112,26 @@ stylishHaskellTests = testGroup "stylish-haskell" [ #if AGPL brittanyTests :: TestTree brittanyTests = testGroup "brittany" [ - goldenVsStringDiff "formats a document with LF endings" goldenGitDiff "test/testdata/BrittanyLF.formatted_document.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + goldenVsStringDiff "formats a document with LF endings" goldenGitDiff "test/testdata/format/BrittanyLF.formatted_document.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "brittany")) doc <- openDoc "BrittanyLF.hs" "haskell" formatDoc doc (FormattingOptions 4 True) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "formats a document with CRLF endings" goldenGitDiff "test/testdata/BrittanyCRLF.formatted_document.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + , goldenVsStringDiff "formats a document with CRLF endings" goldenGitDiff "test/testdata/format/BrittanyCRLF.formatted_document.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "brittany")) doc <- openDoc "BrittanyCRLF.hs" "haskell" formatDoc doc (FormattingOptions 4 True) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "formats a range with LF endings" goldenGitDiff "test/testdata/BrittanyLF.formatted_range.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + , goldenVsStringDiff "formats a range with LF endings" goldenGitDiff "test/testdata/format/BrittanyLF.formatted_range.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "brittany")) doc <- openDoc "BrittanyLF.hs" "haskell" let range = Range (Position 1 0) (Position 2 22) formatRange doc (FormattingOptions 4 True) range BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "formats a range with CRLF endings" goldenGitDiff "test/testdata/BrittanyCRLF.formatted_range.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + , goldenVsStringDiff "formats a range with CRLF endings" goldenGitDiff "test/testdata/format/BrittanyCRLF.formatted_range.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "brittany")) doc <- openDoc "BrittanyCRLF.hs" "haskell" let range = Range (Position 1 0) (Position 2 22) @@ -142,12 +142,12 @@ brittanyTests = testGroup "brittany" [ ormoluTests :: TestTree ormoluTests = testGroup "ormolu" - [ goldenVsStringDiff "formats correctly" goldenGitDiff "test/testdata/Format.ormolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + [ goldenVsStringDiff "formats correctly" goldenGitDiff "test/testdata/format/Format.ormolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "ormolu")) doc <- openDoc "Format.hs" "haskell" formatDoc doc (FormattingOptions 2 True) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "formats imports correctly" goldenGitDiff "test/testdata/Format2.ormolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + , goldenVsStringDiff "formats imports correctly" goldenGitDiff "test/testdata/format/Format2.ormolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "ormolu")) doc <- openDoc "Format2.hs" "haskell" formatDoc doc (FormattingOptions 2 True) @@ -156,12 +156,12 @@ ormoluTests = testGroup "ormolu" fourmoluTests :: TestTree fourmoluTests = testGroup "fourmolu" - [ goldenVsStringDiff "formats correctly" goldenGitDiff "test/testdata/Format.fourmolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + [ goldenVsStringDiff "formats correctly" goldenGitDiff "test/testdata/format/Format.fourmolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "fourmolu")) doc <- openDoc "Format.hs" "haskell" formatDoc doc (FormattingOptions 4 True) BS.fromStrict . T.encodeUtf8 <$> documentContents doc - , goldenVsStringDiff "formats imports correctly" goldenGitDiff "test/testdata/Format2.fourmolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata" $ do + , goldenVsStringDiff "formats imports correctly" goldenGitDiff "test/testdata/format/Format2.fourmolu.formatted.hs" $ runSession hlsCommand fullCaps "test/testdata/format" $ do sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "fourmolu")) doc <- openDoc "Format2.hs" "haskell" formatDoc doc (FormattingOptions 4 True) diff --git a/test/functional/Progress.hs b/test/functional/Progress.hs index 021e7d2a99..1b29e3d6b2 100644 --- a/test/functional/Progress.hs +++ b/test/functional/Progress.hs @@ -41,14 +41,14 @@ tests = _ <- sendRequest WorkspaceExecuteCommand $ ExecuteCommandParams (cmd ^. L.command) (decode $ encode $ fromJust $ cmd ^. L.arguments) Nothing expectProgressReports ["Evaluating"] , testCase "ormolu plugin sends progress notifications" $ do - runSession hlsCommand progressCaps "test/testdata" $ do + runSession hlsCommand progressCaps "test/testdata/format" $ do sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "ormolu")) doc <- openDoc "Format.hs" "haskell" expectProgressReports ["Setting up testdata (for Format.hs)", "Processing"] _ <- sendRequest TextDocumentFormatting $ DocumentFormattingParams doc (FormattingOptions 2 True) Nothing expectProgressReports ["Formatting Format.hs"] , testCase "fourmolu plugin sends progress notifications" $ do - runSession hlsCommand progressCaps "test/testdata" $ do + runSession hlsCommand progressCaps "test/testdata/format" $ do sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "fourmolu")) doc <- openDoc "Format.hs" "haskell" expectProgressReports ["Setting up testdata (for Format.hs)", "Processing"] diff --git a/test/testdata/StylishHaksell.formatted_document.hs b/test/testdata/StylishHaksell.formatted_document.hs deleted file mode 100644 index c695ddcb59..0000000000 --- a/test/testdata/StylishHaksell.formatted_document.hs +++ /dev/null @@ -1,8 +0,0 @@ -import Data.Char -import qualified Data.List -import Data.String - -bar :: Maybe (Either String Integer) -> Integer -bar Nothing = 0 -bar (Just (Left _)) = 0 -bar (Just (Right x)) = x diff --git a/test/testdata/StylishHaksell.formatted_range.hs b/test/testdata/StylishHaksell.formatted_range.hs deleted file mode 100644 index 18f1fe7a0b..0000000000 --- a/test/testdata/StylishHaksell.formatted_range.hs +++ /dev/null @@ -1,8 +0,0 @@ -import Data.Char -import qualified Data.List -import Data.String - -bar :: Maybe (Either String Integer) -> Integer -bar Nothing = 0 -bar (Just (Left _)) = 0 -bar (Just (Right x)) = x diff --git a/test/testdata/BrittanyCRLF.formatted_document.hs b/test/testdata/format/BrittanyCRLF.formatted_document.hs similarity index 100% rename from test/testdata/BrittanyCRLF.formatted_document.hs rename to test/testdata/format/BrittanyCRLF.formatted_document.hs diff --git a/test/testdata/BrittanyCRLF.formatted_range.hs b/test/testdata/format/BrittanyCRLF.formatted_range.hs similarity index 100% rename from test/testdata/BrittanyCRLF.formatted_range.hs rename to test/testdata/format/BrittanyCRLF.formatted_range.hs diff --git a/test/testdata/BrittanyCRLF.hs b/test/testdata/format/BrittanyCRLF.hs similarity index 100% rename from test/testdata/BrittanyCRLF.hs rename to test/testdata/format/BrittanyCRLF.hs diff --git a/test/testdata/BrittanyLF.formatted_document.hs b/test/testdata/format/BrittanyLF.formatted_document.hs similarity index 100% rename from test/testdata/BrittanyLF.formatted_document.hs rename to test/testdata/format/BrittanyLF.formatted_document.hs diff --git a/test/testdata/BrittanyLF.formatted_range.hs b/test/testdata/format/BrittanyLF.formatted_range.hs similarity index 100% rename from test/testdata/BrittanyLF.formatted_range.hs rename to test/testdata/format/BrittanyLF.formatted_range.hs diff --git a/test/testdata/BrittanyLF.hs b/test/testdata/format/BrittanyLF.hs similarity index 100% rename from test/testdata/BrittanyLF.hs rename to test/testdata/format/BrittanyLF.hs diff --git a/test/testdata/Format.brittany.formatted.hs b/test/testdata/format/Format.brittany.formatted.hs similarity index 100% rename from test/testdata/Format.brittany.formatted.hs rename to test/testdata/format/Format.brittany.formatted.hs diff --git a/test/testdata/Format.brittany_post_floskell.formatted.hs b/test/testdata/format/Format.brittany_post_floskell.formatted.hs similarity index 100% rename from test/testdata/Format.brittany_post_floskell.formatted.hs rename to test/testdata/format/Format.brittany_post_floskell.formatted.hs diff --git a/test/testdata/Format.floskell.formatted.hs b/test/testdata/format/Format.floskell.formatted.hs similarity index 100% rename from test/testdata/Format.floskell.formatted.hs rename to test/testdata/format/Format.floskell.formatted.hs diff --git a/test/testdata/Format.formatted_document.hs b/test/testdata/format/Format.formatted_document.hs similarity index 100% rename from test/testdata/Format.formatted_document.hs rename to test/testdata/format/Format.formatted_document.hs diff --git a/test/testdata/Format.formatted_document_with_tabsize.hs b/test/testdata/format/Format.formatted_document_with_tabsize.hs similarity index 100% rename from test/testdata/Format.formatted_document_with_tabsize.hs rename to test/testdata/format/Format.formatted_document_with_tabsize.hs diff --git a/test/testdata/Format.formatted_range.hs b/test/testdata/format/Format.formatted_range.hs similarity index 100% rename from test/testdata/Format.formatted_range.hs rename to test/testdata/format/Format.formatted_range.hs diff --git a/test/testdata/Format.formatted_range_with_tabsize.hs b/test/testdata/format/Format.formatted_range_with_tabsize.hs similarity index 100% rename from test/testdata/Format.formatted_range_with_tabsize.hs rename to test/testdata/format/Format.formatted_range_with_tabsize.hs diff --git a/test/testdata/Format.fourmolu.formatted.hs b/test/testdata/format/Format.fourmolu.formatted.hs similarity index 100% rename from test/testdata/Format.fourmolu.formatted.hs rename to test/testdata/format/Format.fourmolu.formatted.hs diff --git a/test/testdata/Format.hs b/test/testdata/format/Format.hs similarity index 100% rename from test/testdata/Format.hs rename to test/testdata/format/Format.hs diff --git a/test/testdata/Format.ormolu.formatted.hs b/test/testdata/format/Format.ormolu.formatted.hs similarity index 100% rename from test/testdata/Format.ormolu.formatted.hs rename to test/testdata/format/Format.ormolu.formatted.hs diff --git a/test/testdata/Format2.fourmolu.formatted.hs b/test/testdata/format/Format2.fourmolu.formatted.hs similarity index 100% rename from test/testdata/Format2.fourmolu.formatted.hs rename to test/testdata/format/Format2.fourmolu.formatted.hs diff --git a/test/testdata/Format2.hs b/test/testdata/format/Format2.hs similarity index 100% rename from test/testdata/Format2.hs rename to test/testdata/format/Format2.hs diff --git a/test/testdata/Format2.ormolu.formatted.hs b/test/testdata/format/Format2.ormolu.formatted.hs similarity index 100% rename from test/testdata/Format2.ormolu.formatted.hs rename to test/testdata/format/Format2.ormolu.formatted.hs diff --git a/test/testdata/StylishHaksell.format_document.hs b/test/testdata/format/StylishHaskell.formatted_document.hs similarity index 100% rename from test/testdata/StylishHaksell.format_document.hs rename to test/testdata/format/StylishHaskell.formatted_document.hs diff --git a/test/testdata/StylishHaksell.format_range.hs b/test/testdata/format/StylishHaskell.formatted_range.hs similarity index 100% rename from test/testdata/StylishHaksell.format_range.hs rename to test/testdata/format/StylishHaskell.formatted_range.hs diff --git a/test/testdata/StylishHaskell.hs b/test/testdata/format/StylishHaskell.hs similarity index 100% rename from test/testdata/StylishHaskell.hs rename to test/testdata/format/StylishHaskell.hs