forked from nmattia/snack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for multiple source dirs and multiple libraries, nmattia#92.
- Loading branch information
1 parent
90e27fc
commit e3d2b1d
Showing
10 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import qualified Bar | ||
|
||
main :: IO () | ||
main = Bar.main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
1 | ||
2 | ||
3 | ||
4 | ||
5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Bar where | ||
|
||
import Conduit | ||
import FooBar | ||
|
||
main :: IO () | ||
main = runConduit $ spitOut .| takeC 5 .| digest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: snack-multiple-test | ||
|
||
library: | ||
name: lib1 | ||
source-dirs: lib1 | ||
dependencies: | ||
- conduit | ||
|
||
library: | ||
name: lib2 | ||
source-dirs: lib2 | ||
dependencies: | ||
- conduit | ||
- lib1 | ||
|
||
executable: | ||
main: Foo.hs | ||
source-dirs: app | ||
dependencies: | ||
- conduit | ||
- lib1 | ||
- lib2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: snack-multiple-test | ||
|
||
library: | ||
# NOTE: Inherits the package's name. | ||
source-dirs: lib1 | ||
dependencies: | ||
- conduit | ||
|
||
library: | ||
name: lib2 | ||
source-dirs: lib2 | ||
dependencies: | ||
- conduit | ||
- snack-multiple-test | ||
|
||
executable: | ||
main: Foo.hs | ||
source-dirs: app | ||
dependencies: | ||
- conduit | ||
- snack-multiple-test | ||
- lib2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
let | ||
lib1 = | ||
{ src = lib1; | ||
dependencies = [ "conduit" ]; | ||
}; | ||
lib2 = | ||
{ src = lib2; | ||
dependencies = [ "conduit" ]; | ||
}; | ||
in | ||
{ main = "Foo"; | ||
src = ./app; | ||
dependencies = [ "conduit" ]; | ||
packages = [ lib1 lib2 ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ main = "Foo"; | ||
src = [ ./lib1 ./lib2 ./app ]; | ||
dependencies = [ "conduit" ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: snack-multiple-test | ||
|
||
dependencies: | ||
- conduit | ||
|
||
executable: | ||
main: Foo.hs | ||
source-dirs: | ||
- app | ||
- lib1 | ||
- lib2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/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 | ||
} | ||
|
||
# TODO: Fix cannot coerce a list to a string, at /...-snack-lib/files.nix:66:12 | ||
SNACK="snack -j4 -s ./package-src.nix" test | ||
|
||
# TODO: Fix cannot coerce a list to a string, at /...-snack-lib/hpack.nix:60:37 | ||
SNACK="snack -j4 -p ./package-src.yaml" test | ||
|
||
# TODO: Fix cannot coerce a set to a string, at /...-snack-lib/files.nix:66:12 | ||
SNACK="snack -j4 -s ./package-pkg.nix" test | ||
|
||
# TODO: Fix attribute 'lib2' missing, at /...-snack-lib/default.nix:22:18 | ||
SNACK="snack -j4 -p ./package-pkg-name-2.yaml" test | ||
|
||
# TODO: Fix attribute 'lib1' missing, at /...-snack-lib/default.nix:22:18 | ||
SNACK="snack -j4 -p ./package-pkg-name-12.yaml" test |