gc test
This commit is contained in:
parent
2726e83235
commit
f1f4d5e836
@ -47,7 +47,7 @@ data GCOptions = GCOptions
|
|||||||
, gcHLSNoGHC :: Bool
|
, gcHLSNoGHC :: Bool
|
||||||
, gcCache :: Bool
|
, gcCache :: Bool
|
||||||
, gcTmp :: Bool
|
, gcTmp :: Bool
|
||||||
}
|
} deriving (Eq, Show)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ data RunOptions = RunOptions
|
|||||||
, runBinDir :: Maybe FilePath
|
, runBinDir :: Maybe FilePath
|
||||||
, runQuick :: Bool
|
, runQuick :: Bool
|
||||||
, runCOMMAND :: [String]
|
, runCOMMAND :: [String]
|
||||||
}
|
} deriving (Eq, Show)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -428,6 +428,8 @@ test-suite ghcup-optparse-test
|
|||||||
UpgradeTest
|
UpgradeTest
|
||||||
CompileTest
|
CompileTest
|
||||||
WhereisTest
|
WhereisTest
|
||||||
|
GCTest
|
||||||
|
RunTest
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
build-depends: base, ghcup, ghcup-optparse, tasty, tasty-hunit, optparse-applicative, versions, text, uri-bytestring
|
build-depends: base, ghcup, ghcup-optparse, tasty, tasty-hunit, optparse-applicative, versions, text, uri-bytestring
|
||||||
|
42
test/optparse-test/GCTest.hs
Normal file
42
test/optparse-test/GCTest.hs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
module GCTest where
|
||||||
|
|
||||||
|
import Test.Tasty
|
||||||
|
import GHCup.OptParse
|
||||||
|
import Utils
|
||||||
|
|
||||||
|
|
||||||
|
gcTests :: TestTree
|
||||||
|
gcTests = buildTestTree gcParseWith ("gc", gcCheckList)
|
||||||
|
|
||||||
|
defaultOptions :: GCOptions
|
||||||
|
defaultOptions =
|
||||||
|
GCOptions
|
||||||
|
False
|
||||||
|
False
|
||||||
|
False
|
||||||
|
False
|
||||||
|
False
|
||||||
|
False
|
||||||
|
|
||||||
|
gcCheckList :: [(String, GCOptions)]
|
||||||
|
gcCheckList =
|
||||||
|
[ ("gc", defaultOptions)
|
||||||
|
, ("gc -o", defaultOptions{gcOldGHC = True})
|
||||||
|
, ("gc --ghc-old", defaultOptions{gcOldGHC = True})
|
||||||
|
, ("gc -p", defaultOptions{gcProfilingLibs = True})
|
||||||
|
, ("gc --profiling-libs", defaultOptions{gcProfilingLibs = True})
|
||||||
|
, ("gc -s", defaultOptions{gcShareDir = True})
|
||||||
|
, ("gc --share-dir", defaultOptions{gcShareDir = True})
|
||||||
|
, ("gc -h", defaultOptions{gcHLSNoGHC = True})
|
||||||
|
, ("gc --hls-no-ghc", defaultOptions{gcHLSNoGHC = True})
|
||||||
|
, ("gc -c", defaultOptions{gcCache = True})
|
||||||
|
, ("gc --cache", defaultOptions{gcCache = True})
|
||||||
|
, ("gc -t", defaultOptions{gcTmp = True})
|
||||||
|
, ("gc --tmpdirs", defaultOptions{gcTmp = True})
|
||||||
|
, ("gc -o -p -s -h -c -t", GCOptions True True True True True True)
|
||||||
|
]
|
||||||
|
|
||||||
|
gcParseWith :: [String] -> IO GCOptions
|
||||||
|
gcParseWith args = do
|
||||||
|
GC a <- parseWith args
|
||||||
|
pure a
|
@ -12,6 +12,7 @@ import qualified ListTest
|
|||||||
import qualified UpgradeTest
|
import qualified UpgradeTest
|
||||||
import qualified CompileTest
|
import qualified CompileTest
|
||||||
import qualified WhereisTest
|
import qualified WhereisTest
|
||||||
|
import qualified GCTest
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = defaultMain $ testGroup "ghcup"
|
main = defaultMain $ testGroup "ghcup"
|
||||||
@ -26,4 +27,5 @@ main = defaultMain $ testGroup "ghcup"
|
|||||||
, UpgradeTest.upgradeTests
|
, UpgradeTest.upgradeTests
|
||||||
, CompileTest.compileTests
|
, CompileTest.compileTests
|
||||||
, WhereisTest.whereisTests
|
, WhereisTest.whereisTests
|
||||||
|
, GCTest.gcTests
|
||||||
]
|
]
|
||||||
|
31
test/optparse-test/RunTest.hs
Normal file
31
test/optparse-test/RunTest.hs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
module RunTest where
|
||||||
|
|
||||||
|
import Test.Tasty
|
||||||
|
import GHCup.OptParse
|
||||||
|
import Utils
|
||||||
|
|
||||||
|
|
||||||
|
runTests :: TestTree
|
||||||
|
runTests = buildTestTree runParseWith ("run", runCheckList)
|
||||||
|
|
||||||
|
defaultOptions :: RunOptions
|
||||||
|
defaultOptions =
|
||||||
|
RunOptions
|
||||||
|
False
|
||||||
|
False
|
||||||
|
False
|
||||||
|
Nothing
|
||||||
|
Nothing
|
||||||
|
Nothing
|
||||||
|
Nothing
|
||||||
|
Nothing
|
||||||
|
False
|
||||||
|
[]
|
||||||
|
|
||||||
|
runCheckList :: [(String, RunOptions)]
|
||||||
|
runCheckList = []
|
||||||
|
|
||||||
|
runParseWith :: [String] -> IO RunOptions
|
||||||
|
runParseWith args = do
|
||||||
|
Run a <- parseWith args
|
||||||
|
pure a
|
Loading…
Reference in New Issue
Block a user