mirror of
https://github.com/nmattia/snack.git
synced 2024-09-11 11:55:36 +03:00
Add test for dirty source trees
This commit is contained in:
parent
eae3476af6
commit
5e95499105
@ -74,11 +74,6 @@ for t in $SNACK_TESTS; do
|
||||
popd
|
||||
done
|
||||
|
||||
banner "Test that versions are stripped in package.yaml"
|
||||
pushd tests/strips-versions
|
||||
./test
|
||||
popd
|
||||
|
||||
banner "Test this file's formatting"
|
||||
list=$(shfmt -i 2 -l script/test)
|
||||
if [[ -n "$list" ]]; then
|
||||
|
5
tests/library-3/golden
Normal file
5
tests/library-3/golden
Normal file
@ -0,0 +1,5 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
5
tests/library-3/golden.jq
Normal file
5
tests/library-3/golden.jq
Normal file
@ -0,0 +1,5 @@
|
||||
[
|
||||
"Bar",
|
||||
"Foo",
|
||||
"FooBar"
|
||||
]
|
0
tests/library-3/lib/.Foo.hs
Normal file
0
tests/library-3/lib/.Foo.hs
Normal file
7
tests/library-3/lib/Bar.hs
Normal file
7
tests/library-3/lib/Bar.hs
Normal file
@ -0,0 +1,7 @@
|
||||
module Bar where
|
||||
|
||||
import Conduit
|
||||
import FooBar
|
||||
|
||||
main :: IO ()
|
||||
main = runConduit $ spitOut .| takeC 5 .| digest
|
6
tests/library-3/lib/Foo.hs
Normal file
6
tests/library-3/lib/Foo.hs
Normal file
@ -0,0 +1,6 @@
|
||||
module Foo where
|
||||
|
||||
import qualified Bar
|
||||
|
||||
someFunc :: IO ()
|
||||
someFunc = Bar.main
|
10
tests/library-3/snack.nix
Normal file
10
tests/library-3/snack.nix
Normal file
@ -0,0 +1,10 @@
|
||||
let
|
||||
my-lib =
|
||||
{ src = ./src;
|
||||
dependencies = [ "conduit" ];
|
||||
};
|
||||
in
|
||||
{ src = ./lib;
|
||||
dependencies = [ "conduit" ];
|
||||
packages = [ my-lib ];
|
||||
}
|
9
tests/library-3/src/FooBar.hs
Normal file
9
tests/library-3/src/FooBar.hs
Normal file
@ -0,0 +1,9 @@
|
||||
module FooBar where
|
||||
|
||||
import Conduit
|
||||
|
||||
spitOut :: ConduitT () Int IO ()
|
||||
spitOut = yieldMany [ 1 ..]
|
||||
|
||||
digest :: ConduitT Int Void IO ()
|
||||
digest = mapM_C print
|
20
tests/library-3/test
Executable file
20
tests/library-3/test
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
# vim: ft=sh sw=2 et
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
test() {
|
||||
TMP_FILE=$(mktemp)
|
||||
|
||||
cat $($SNACK build) | jq -M '.result | keys' > $TMP_FILE
|
||||
|
||||
diff golden.jq $TMP_FILE
|
||||
|
||||
capture_io "$TMP_FILE" main | $SNACK ghci
|
||||
diff golden $TMP_FILE
|
||||
rm $TMP_FILE
|
||||
}
|
||||
|
||||
SNACK="snack" test
|
||||
SNACK="snack -s ./snack.nix" test
|
||||
# Note: no HPack test, because HPack doesn't support multi library
|
Loading…
Reference in New Issue
Block a user