mirror of
https://github.com/nmattia/snack.git
synced 2024-09-11 11:55:36 +03:00
Add test case for nested module failure
This commit is contained in:
parent
dde00575c5
commit
89f6c30aa0
@ -94,6 +94,11 @@ pushd tests/hpack
|
||||
./test
|
||||
popd
|
||||
|
||||
banner "nested modules"
|
||||
pushd tests/nested
|
||||
./test
|
||||
popd
|
||||
|
||||
banner "Test readme folder"
|
||||
pushd tests/readme
|
||||
echo | snack ghci --package-yaml ./package.yaml
|
||||
|
5
tests/nested/golden
Normal file
5
tests/nested/golden
Normal file
@ -0,0 +1,5 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
6
tests/nested/package.yaml
Normal file
6
tests/nested/package.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
name: snack-packages-test
|
||||
dependencies:
|
||||
- conduit
|
||||
executable:
|
||||
main: Foo/Foo.hs
|
||||
source-dirs: src
|
4
tests/nested/snack.nix
Normal file
4
tests/nested/snack.nix
Normal file
@ -0,0 +1,4 @@
|
||||
{ main = "Foo.Foo";
|
||||
src = ./src;
|
||||
dependencies = ["conduit"];
|
||||
}
|
5
tests/nested/src/Bar/Foo.hs
Normal file
5
tests/nested/src/Bar/Foo.hs
Normal file
@ -0,0 +1,5 @@
|
||||
import Conduit
|
||||
import FooBar
|
||||
|
||||
main :: IO ()
|
||||
main = runConduit $ spitOut .| takeC 5 .| digest
|
9
tests/nested/src/Bar/FooBar.hs
Normal file
9
tests/nested/src/Bar/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
|
21
tests/nested/test
Executable file
21
tests/nested/test
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# vim: ft=sh sw=2 et
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
test() {
|
||||
$SNACK build
|
||||
$SNACK run | diff golden -
|
||||
|
||||
TMP_FILE=$(mktemp)
|
||||
|
||||
capture_io "$TMP_FILE" main | $SNACK ghci
|
||||
|
||||
diff golden $TMP_FILE
|
||||
rm $TMP_FILE
|
||||
}
|
||||
|
||||
SNACK="snack" test
|
||||
SNACK="snack -s ./snack.nix" test
|
||||
SNACK="snack --package-yaml ./package.yaml" test
|
Loading…
Reference in New Issue
Block a user