This repository has been archived by the owner on Mar 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22c4663
commit 97c3f29
Showing
7 changed files
with
103 additions
and
1 deletion.
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 @@ | ||
/home/syd/super-user-spark/test_sandbox/bash/bash_aliases |
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 @@ | ||
/home/syd/super-user-spark/test_sandbox/bash/bash_profile |
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 @@ | ||
/home/syd/super-user-spark/test_sandbox/bash/bashrc |
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
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,62 @@ | ||
module EndToEndSpec (spec) where | ||
|
||
import Spark | ||
import System.Directory hiding (createDirectoryIfMissing) | ||
import System.Environment (withArgs) | ||
import System.FilePath.Posix ((</>)) | ||
import System.Posix.Files | ||
import Test.Hspec | ||
import Test.QuickCheck | ||
import Utils | ||
|
||
spec :: Spec | ||
spec = do | ||
let sandbox = "test_sandbox" | ||
let setup = createDirectoryIfMissing sandbox | ||
let teardown = removeDirectoryRecursive sandbox | ||
|
||
let rsc = "test_resources" </> "end-to-end" | ||
|
||
beforeAll_ setup $ afterAll_ teardown $ do | ||
describe "standard bash card test" $ do | ||
let bashrsc = rsc </> "bash.sus" | ||
let bashrscres = rsc </> "bash.sus.res" | ||
let cardfile = sandbox </> "bash.sus" | ||
|
||
let up = do | ||
copyFile bashrsc cardfile | ||
withCurrentDirectory sandbox $ do | ||
createDirectoryIfMissing "bash" | ||
withCurrentDirectory "bash" $ do | ||
writeFile "bash_aliases" "bash_aliases" | ||
writeFile "bashrc" "bashrc" | ||
writeFile "bash_profile" "bash_profile" | ||
|
||
let down = do | ||
removeFile cardfile | ||
withCurrentDirectory sandbox $ do | ||
removeDirectoryRecursive "bash" | ||
|
||
|
||
beforeAll_ up $ afterAll_ down $ do | ||
it "parses correcty" $ do | ||
withArgs ["parse", cardfile] spark `shouldReturn` () | ||
|
||
it "compiles correctly" $ do | ||
let outfile = sandbox </> "bash.sus.res" | ||
|
||
withArgs ["compile", cardfile, "--output", outfile] spark `shouldReturn` () | ||
|
||
actual <- readFile outfile | ||
expected <- readFile bashrscres | ||
actual `shouldBe` expected | ||
|
||
it "checks without exceptions" $ do | ||
withArgs ["check", cardfile] spark `shouldReturn` () | ||
|
||
it "deploys correctly" $ do | ||
withArgs ["deploy", cardfile] spark `shouldReturn` () | ||
|
||
readFile ("subdir" </> ".bashrc") `shouldReturn` "bashrc" | ||
readFile ("subdir" </> ".bash_aliases") `shouldReturn` "bash_aliases" | ||
readFile ("subdir" </> ".bash_profile") `shouldReturn` "bash_profile" |
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,8 @@ | ||
card bash { | ||
into subdir | ||
outof bash | ||
|
||
.bashrc | ||
.bash_aliases | ||
.bash_profile | ||
} |
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,26 @@ | ||
[ | ||
{ | ||
"destination": "subdir/.bashrc", | ||
"sources": [ | ||
"bash/.bashrc", | ||
"bash/bashrc" | ||
], | ||
"deployment kind": "link" | ||
}, | ||
{ | ||
"destination": "subdir/.bash_aliases", | ||
"sources": [ | ||
"bash/.bash_aliases", | ||
"bash/bash_aliases" | ||
], | ||
"deployment kind": "link" | ||
}, | ||
{ | ||
"destination": "subdir/.bash_profile", | ||
"sources": [ | ||
"bash/.bash_profile", | ||
"bash/bash_profile" | ||
], | ||
"deployment kind": "link" | ||
} | ||
] |