-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test for 'Dyre.configCheck' parameter.
- Loading branch information
1 parent
019476f
commit 0c560df
Showing
5 changed files
with
59 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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,19 @@ | |||
module ConfigCheckTest where | |||
|
|||
import qualified Config.Dyre as Dyre | |||
import System.IO | |||
|
|||
configCheckMain = Dyre.wrapMain $ Dyre.defaultParams | |||
{ Dyre.projectName = "configCheckTest" | |||
, Dyre.realMain = putStrLn | |||
, Dyre.showError = const | |||
, Dyre.statusOut = const . return $ () | |||
} | |||
|
|||
configCheckTest = Dyre.wrapMain $ Dyre.defaultParams | |||
{ Dyre.projectName = "configCheckTest" | |||
, Dyre.realMain = putStrLn | |||
, Dyre.showError = const | |||
, Dyre.statusOut = const . return $ () | |||
, Dyre.configCheck = False | |||
} |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
import ConfigCheckTest | |||
main = configCheckMain "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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
import ConfigCheckTest | |||
main = configCheckTest "custom-a" |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
import ConfigCheckTest | |||
main = configCheckTest "custom-b" |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,34 @@ | |||
#!/bin/sh | |||
|
|||
# Tests Dyre's ability to recompile a custom configuration | |||
# upon relaunch, and restore the state again after. | |||
|
|||
# Assert the equality of two strings. | |||
function assert() { | |||
if [ "$1" != "$2" ]; then | |||
echo "Failed test $3"; | |||
exit 1; | |||
fi | |||
} | |||
|
|||
mkdir working | |||
cd working | |||
|
|||
### TEST A ### | |||
cp ../ConfigCheckTest.hs ../Main.hs . | |||
cp ../configCheckTestA.hs ./configCheckTest.hs | |||
ghc --make Main.hs -o configCheck 2> /dev/null | |||
OUTPUT_A=`./configCheck --dyre-debug` | |||
assert "$OUTPUT_A" "custom-a" "A" | |||
|
|||
sleep 1 | |||
|
|||
### TEST B ### | |||
cp ../configCheckTestB.hs ./configCheckTest.hs | |||
mv cache/configCheckTest* configCheck | |||
OUTPUT_B=`./configCheck --dyre-debug` | |||
assert "$OUTPUT_B" "custom-a" "B" | |||
|
|||
echo "Passed" | |||
cd .. | |||
rm -r working |