From 5737f5185fbfd9d24dc8dc578f61cd8e8240e05a Mon Sep 17 00:00:00 2001 From: Peter Wicks Stringfield Date: Wed, 6 Jan 2021 03:11:28 -0600 Subject: [PATCH] Delete unused utilities for controlling logging. (#764) * 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. * Delete unused import. Co-authored-by: Javier Neira Co-authored-by: Junyoung Clare Jang Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- test/functional/FunctionalBadProject.hs | 1 - test/utils/Test/Hls/Util.hs | 26 ------------------------- 2 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/utils/Test/Hls/Util.hs b/test/utils/Test/Hls/Util.hs index 9fcd5331e9..b5e1189b09 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 @@ -52,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 @@ -63,13 +59,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 +66,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 ()