Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate UnitTests #4268

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions ghcide/test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,7 @@

module Main (main) where
-- import Test.QuickCheck.Instances ()
import Data.Function ((&))
import qualified HieDbRetry
import Ide.Logger (Pretty (pretty),
Priority (Debug),
WithPriority (WithPriority, priority),
cfilter, cmapWithPrio,
makeDefaultStderrRecorder)
import Test.Tasty
import Test.Tasty.Ingredients.Rerun

Expand All @@ -48,7 +42,6 @@ import CompletionTests
import CPPTests
import CradleTests
import DependentFileTest
import Development.IDE (LoggingColumn (..))
import DiagnosticTests
import ExceptionTests
import FindDefinitionAndHoverTests
Expand All @@ -74,15 +67,6 @@ import WatchedFileTests

main :: IO ()
main = do
docWithPriorityRecorder <- makeDefaultStderrRecorder (Just [ThreadIdColumn, PriorityColumn, DataColumn])

let docWithFilteredPriorityRecorder =
docWithPriorityRecorder
& cfilter (\WithPriority{ priority } -> priority >= Debug)

let recorder = docWithFilteredPriorityRecorder
& cmapWithPrio pretty

-- We mess with env vars so run single-threaded.
defaultMainWithRerun $ testGroup "ghcide"
[ OpenCloseTest.tests
Expand All @@ -99,7 +83,7 @@ main = do
, THTests.tests
, SymlinkTests.tests
, SafeTests.tests
, UnitTests.tests recorder
, UnitTests.tests
, HaddockTests.tests
, PositionMappingTests.tests
, WatchedFileTests.tests
Expand Down
10 changes: 3 additions & 7 deletions ghcide/test/exe/UnitTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ import Data.List.Extra
import Data.String (IsString (fromString))
import qualified Data.Text as T
import Development.IDE.Core.FileStore (getModTime)
import qualified Development.IDE.Main as IDE
import qualified Development.IDE.Plugin.HLS.GhcIde as Ghcide
import qualified Development.IDE.Types.Diagnostics as Diagnostics
import Development.IDE.Types.Location
import qualified FuzzySearch
import Ide.Logger (Recorder, WithPriority,
cmapWithPrio)
import Ide.Logger (Recorder, WithPriority)
import Ide.PluginUtils (pluginDescToIdePlugins)
import Ide.Types
import Language.LSP.Protocol.Message
Expand All @@ -26,7 +24,6 @@ import Language.LSP.Protocol.Types hiding
SemanticTokensEdit (..),
mkRange)
import Language.LSP.Test
import LogType (Log (..))
import Network.URI
import qualified Progress
import System.IO.Extra hiding (withTempDir)
Expand All @@ -37,11 +34,10 @@ import Test.Hls (IdeState, def,
import Test.Tasty
import Test.Tasty.ExpectedFailure
import Test.Tasty.HUnit
import TestUtils
import Text.Printf (printf)

tests :: Recorder (WithPriority Log) -> TestTree
tests recorder = do
tests :: TestTree
tests = do
testGroup "Unit"
[ testCase "empty file path does NOT work with the empty String literal" $
uriToFilePath' (fromNormalizedUri $ filePathToUri' "") @?= Just "."
Expand Down
Loading