Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
Packages
Cabal
Commits
e34235c6
Commit
e34235c6
authored
8 years ago
by
Edward Z. Yang
Browse files
Options
Downloads
Patches
Plain Diff
Add testTreeSteps to let long test cases have steps annotated.
Signed-off-by:
Edward Z. Yang
<
ezyang@cs.stanford.edu
>
parent
c6c3f2c5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Cabal/tests/PackageTests/PackageTester.hs
+8
-0
8 additions, 0 deletions
Cabal/tests/PackageTests/PackageTester.hs
Cabal/tests/PackageTests/Tests.hs
+21
-3
21 additions, 3 deletions
Cabal/tests/PackageTests/Tests.hs
with
29 additions
and
3 deletions
Cabal/tests/PackageTests/PackageTester.hs
+
8
−
0
View file @
e34235c6
...
...
@@ -64,6 +64,7 @@ module PackageTests.PackageTester
,
TestTreeM
,
runTestTree
,
testTree
,
testTreeSteps
,
testTreeSub
,
testTree'
,
groupTests
...
...
@@ -778,10 +779,17 @@ testTree :: SuiteConfig -> String -> TestM a -> TestTreeM ()
testTree
config
name
m
=
testTree'
$
HUnit
.
testCase
name
$
runTestM
config
name
Nothing
m
testTreeSteps
::
SuiteConfig
->
String
->
((
String
->
TestM
()
)
->
TestM
a
)
->
TestTreeM
()
testTreeSteps
config
name
f
=
testTree'
.
HUnit
.
testCaseSteps
name
$
\
step
->
runTestM
config
name
Nothing
(
f
(
liftIO
.
step
))
testTreeSub
::
SuiteConfig
->
String
->
String
->
TestM
a
->
TestTreeM
()
testTreeSub
config
name
sub_name
m
=
testTree'
$
HUnit
.
testCase
(
name
</>
sub_name
)
$
runTestM
config
name
(
Just
sub_name
)
m
-- TODO testTreeSubSteps
testTree'
::
TestTree
->
TestTreeM
()
testTree'
tc
=
tell
[
tc
]
...
...
This diff is collapsed.
Click to expand it.
Cabal/tests/PackageTests/Tests.hs
+
21
−
3
View file @
e34235c6
...
...
@@ -409,13 +409,16 @@ tests config = do
runExe'
"T3294"
[]
>>=
assertOutputContains
"bbb"
-- Test build --assume-deps-up-to-date
tc
"BuildAssumeDepsUpToDate"
$
do
mtc
"BuildAssumeDepsUpToDate"
$
\
step
->
do
step
"Initial build"
pkg_dir
<-
packageDir
liftIO
$
writeFile
(
pkg_dir
</>
"A.hs"
)
"module A where
\n
a =
\"
a1
\"
"
liftIO
$
writeFile
(
pkg_dir
</>
"myprog/Main.hs"
)
"import A
\n
main = print (a ++
\"
b1
\"
)"
cabal_build
[]
runExe'
"myprog"
[]
>>=
assertOutputContains
"a1 b1"
step
"Rebuild executable only"
ghcFileModDelay
liftIO
$
writeFile
(
pkg_dir
</>
"A.hs"
)
"module A where
\n
a =
\"
a2
\"
"
liftIO
$
writeFile
(
pkg_dir
</>
"myprog/Main.hs"
)
"import A
\n
main = print (a ++
\"
b2
\"
)"
...
...
@@ -424,35 +427,47 @@ tests config = do
>>=
assertOutputContains
"a1 b2"
-- Test copy --assume-deps-up-to-date
tc
"CopyAssumeDepsUpToDate"
$
do
m
tc
"CopyAssumeDepsUpToDate"
$
\
step
->
do
withPackageDb
$
do
step
"Initial build"
cabal_build
[]
step
"Executable cannot find data file"
pkg_dir
<-
packageDir
shouldFail
(
runExe'
"myprog"
[]
)
>>=
assertOutputContains
"does not exist"
prefix_dir
<-
prefixDir
shouldNotExist
$
prefix_dir
</>
"bin"
</>
"myprog"
step
"Install data file"
liftIO
$
writeFile
(
pkg_dir
</>
"data"
)
"aaa"
cabal
"copy"
[
"--assume-deps-up-to-date"
]
shouldNotExist
$
prefix_dir
</>
"bin"
</>
"myprog"
runExe'
"myprog"
[]
>>=
assertOutputContains
"aaa"
step
"Install executable"
liftIO
$
writeFile
(
pkg_dir
</>
"data"
)
"bbb"
cabal
"copy"
[
"--assume-deps-up-to-date"
,
"myprog"
]
runInstalledExe'
"myprog"
[]
>>=
assertOutputContains
"aaa"
-- Test register --assume-deps-up-to-date
tc
"RegisterAssumeDepsUpToDate"
$
do
m
tc
"RegisterAssumeDepsUpToDate"
$
\
step
->
do
withPackageDb
$
do
-- We'll test this by generating registration files and verifying
-- that they are indeed files (and not directories)
step
"Initial build and copy"
cabal_build
[]
cabal
"copy"
[]
step
"Register q"
let
q_reg
=
"pkg-config-q"
cabal
"register"
[
"--assume-deps-up-to-date"
,
"q"
,
"--gen-pkg-config="
++
q_reg
]
pkg_dir
<-
packageDir
ghcPkg
"register"
[
pkg_dir
</>
q_reg
]
step
"Register p"
let
main_reg
=
"pkg-config-p"
cabal
"register"
[
"--assume-deps-up-to-date"
,
"RegisterAssumeDepsUpToDate"
,
"--gen-pkg-config="
++
main_reg
]
ghcPkg
"register"
[
pkg_dir
</>
main_reg
]
...
...
@@ -517,6 +532,9 @@ tests config = do
tc
::
FilePath
->
TestM
a
->
TestTreeM
()
tc
name
=
testTree
config
name
mtc
::
FilePath
->
((
String
->
TestM
()
)
->
TestM
a
)
->
TestTreeM
()
mtc
name
=
testTreeSteps
config
name
tcs
::
FilePath
->
FilePath
->
TestM
a
->
TestTreeM
()
tcs
name
sub_name
m
=
testTreeSub
config
name
sub_name
m
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment