From 07fb6877f458eab020fa4d1bfdf18737dba998dc Mon Sep 17 00:00:00 2001 From: Peter Wicks Stringfield Date: Sun, 27 Dec 2020 16:12:06 -0600 Subject: [PATCH 1/2] Delete unused utilities for controlling logging. Delete withFileLogging, logConfig, and noLogConfig. Logging is turned on by hlsCommand. Should we ever want to disable it for a certain test, we would create a new version of hlsCommand, say, hlsCommandNoLog. --- test/functional/FunctionalBadProject.hs | 1 - test/functional/FunctionalLiquid.hs | 1 - test/utils/Test/Hls/Util.hs | 25 ------------------------- 3 files changed, 27 deletions(-) diff --git a/test/functional/FunctionalBadProject.hs b/test/functional/FunctionalBadProject.hs index 999b69e6ce..1e8082427f 100644 --- a/test/functional/FunctionalBadProject.hs +++ b/test/functional/FunctionalBadProject.hs @@ -24,7 +24,6 @@ tests = testGroup "behaviour on malformed projects" [ -- testCase "deals with cabal file with unsatisfiable dependency" $ -- runSession hlsCommandExamplePlugin codeActionSupportCaps "test/testdata/badProjects/cabal" $ do - -- -- runSessionWithConfig logConfig hlsCommandExamplePlugin codeActionSupportCaps "test/testdata" $ do -- _doc <- openDoc "Foo.hs" "haskell" -- diags@(d:_) <- waitForDiagnosticsSource "bios" diff --git a/test/functional/FunctionalLiquid.hs b/test/functional/FunctionalLiquid.hs index 96e9862ade..f3d0673baf 100644 --- a/test/functional/FunctionalLiquid.hs +++ b/test/functional/FunctionalLiquid.hs @@ -52,7 +52,6 @@ tests = testGroup "liquid haskell diagnostics" [ , ignoreTestBecause "Broken" $ testCase "runs diagnostics on save, with liquid haskell" $ runSession hlsCommand codeActionSupportCaps "test/testdata" $ do - -- runSessionWithConfig logConfig hlsCommand codeActionSupportCaps "test/testdata" $ do doc <- openDoc "liquid/Evens.hs" "haskell" diags@(reduceDiag:_) <- waitForDiagnostics diff --git a/test/utils/Test/Hls/Util.hs b/test/utils/Test/Hls/Util.hs index 9fcd5331e9..a8129c9ce7 100644 --- a/test/utils/Test/Hls/Util.hs +++ b/test/utils/Test/Hls/Util.hs @@ -20,14 +20,11 @@ module Test.Hls.Util , inspectCommand , inspectDiagnostic , knownBrokenForGhcVersions - , logConfig , logFilePath - , noLogConfig , setupBuildToolFiles , waitForDiagnosticsFrom , waitForDiagnosticsFromSource , waitForDiagnosticsFromSourceWithTimeout - , withFileLogging , withCurrentDirectoryInTmp ) where @@ -63,13 +60,6 @@ import Test.Tasty.HUnit (assertFailure) import Text.Blaze.Renderer.String (renderMarkup) import Text.Blaze.Internal hiding (null) - -noLogConfig :: Test.SessionConfig -noLogConfig = Test.defaultConfig { Test.logMessages = False } - -logConfig :: Test.SessionConfig -logConfig = Test.defaultConfig { Test.logMessages = True } - codeActionSupportCaps :: C.ClientCapabilities codeActionSupportCaps = def { C._textDocument = Just textDocumentCaps } where @@ -77,21 +67,6 @@ codeActionSupportCaps = def { C._textDocument = Just textDocumentCaps } codeActionCaps = C.CodeActionClientCapabilities (Just True) (Just literalSupport) literalSupport = C.CodeActionLiteralSupport def -withFileLogging :: FilePath -> IO a -> IO a -withFileLogging logFile f = do - let logDir = "./test-logs" - logPath = logDir logFile - - dirExists <- doesDirectoryExist logDir - unless dirExists $ createDirectory logDir - - exists <- doesFileExist logPath - when exists $ removeFile logPath - - setupLogger (Just logPath) ["hie"] L.DEBUG - - f - -- --------------------------------------------------------------------- setupBuildToolFiles :: IO () From 83e856ec6d665f223964d27f0e8f50ddede3c4c4 Mon Sep 17 00:00:00 2001 From: Peter Wicks Stringfield Date: Mon, 4 Jan 2021 18:35:35 -0600 Subject: [PATCH 2/2] Delete unused import. --- test/utils/Test/Hls/Util.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/utils/Test/Hls/Util.hs b/test/utils/Test/Hls/Util.hs index a8129c9ce7..b5e1189b09 100644 --- a/test/utils/Test/Hls/Util.hs +++ b/test/utils/Test/Hls/Util.hs @@ -49,7 +49,6 @@ import System.Directory import System.Environment import System.Time.Extra (Seconds, sleep) import System.FilePath -import qualified System.Log.Logger as L import System.IO.Temp import System.IO.Unsafe import Test.Hspec.Runner