1
1
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:
Nicolas Mattia 2018-07-25 16:25:02 +02:00
parent dde00575c5
commit 89f6c30aa0
7 changed files with 55 additions and 0 deletions

View File

@ -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
View File

@ -0,0 +1,5 @@
1
2
3
4
5

View 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
View File

@ -0,0 +1,4 @@
{ main = "Foo.Foo";
src = ./src;
dependencies = ["conduit"];
}

View File

@ -0,0 +1,5 @@
import Conduit
import FooBar
main :: IO ()
main = runConduit $ spitOut .| takeC 5 .| digest

View 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
View 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