summaryrefslogtreecommitdiff
path: root/yarn.tests
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2013-07-06 08:51:32 +0100
committerLars Wirzenius <liw@liw.fi>2013-07-06 08:51:32 +0100
commit4747bbd187d27fabef1e9514ebcec584980400e3 (patch)
treee69ed2add7f444ba1eb2955c3290fd664b6f60b9 /yarn.tests
parent2aab9e3b752d94197ab24af876ee3ae857c3ede9 (diff)
downloadcmdtest-4747bbd187d27fabef1e9514ebcec584980400e3.tar.gz
Add test case for snapshotting
Diffstat (limited to 'yarn.tests')
-rwxr-xr-xyarn.tests/snapshot.script41
1 files changed, 41 insertions, 0 deletions
diff --git a/yarn.tests/snapshot.script b/yarn.tests/snapshot.script
new file mode 100755
index 0000000..90db93e
--- /dev/null
+++ b/yarn.tests/snapshot.script
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+set -eu
+
+cat << EOF > "$DATADIR/foo.yarn"
+ SCENARIO foo
+ GIVEN foo
+ WHEN foo
+ THEN foo
+
+ IMPLEMENTS GIVEN foo
+ touch "\$DATADIR/foo.given"
+
+ IMPLEMENTS WHEN foo
+ touch "\$DATADIR/foo.when"
+
+ IMPLEMENTS THEN foo
+ touch "\$DATADIR/foo.then"
+EOF
+
+./yarn -q --snapshot --tempdir "$DATADIR/tmp" "$DATADIR/foo.yarn"
+
+test -e "$DATADIR/tmp/001-GIVEN-foo"
+test -e "$DATADIR/tmp/001-GIVEN-foo/foo.given"
+! test -e "$DATADIR/tmp/datadir/foo.when"
+! test -e "$DATADIR/tmp/datadir/foo.then"
+
+test -e "$DATADIR/tmp/002-WHEN-foo"
+test -e "$DATADIR/tmp/002-WHEN-foo/foo.given"
+test -e "$DATADIR/tmp/002-WHEN-foo/foo.when"
+! test -e "$DATADIR/tmp/002-WHEN-foo/foo.then"
+
+test -e "$DATADIR/tmp/003-THEN-foo"
+test -e "$DATADIR/tmp/003-THEN-foo/foo.given"
+test -e "$DATADIR/tmp/003-THEN-foo/foo.when"
+test -e "$DATADIR/tmp/003-THEN-foo/foo.then"
+
+test -e "$DATADIR/tmp/datadir"
+test -e "$DATADIR/tmp/datadir/foo.given"
+test -e "$DATADIR/tmp/datadir/foo.when"
+test -e "$DATADIR/tmp/datadir/foo.then"