summaryrefslogtreecommitdiff
path: root/yarn.tests/snapshot.script
blob: 90db93e130eed3f6a014ecb9cfe2664be2fa9d3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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"