summaryrefslogtreecommitdiff
path: root/yarn.tests/snapshot.script
blob: def73a83ebc7b02de50e6ae49624e57adf271a6e (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh

set -eu

cat << EOF > "$DATADIR/foo.yarn"
    SCENARIO foo
    GIVEN foo
    WHEN foo
    THEN foo

    SCENARIO bar
    GIVEN bar
    WHEN bar
    THEN bar

    IMPLEMENTS GIVEN (.*)
    touch "\$DATADIR/\$MATCH_1.given"

    IMPLEMENTS WHEN (.*)
    touch "\$DATADIR/\$MATCH_1.when"

    IMPLEMENTS THEN (.*)
    touch "\$DATADIR/\$MATCH_1.then"
EOF

./run-yarn --snapshot --tempdir "$DATADIR/tmp" "$DATADIR/foo.yarn"

test -e "$DATADIR/tmp/bar"
test -e "$DATADIR/tmp/bar/datadir"
test -e "$DATADIR/tmp/bar/datadir/bar.given"
test -e "$DATADIR/tmp/bar/datadir/bar.when"
test -e "$DATADIR/tmp/bar/datadir/bar.then"

test -e "$DATADIR/tmp/bar/001-GIVEN-bar"
test -e "$DATADIR/tmp/bar/001-GIVEN-bar/bar.given"
! test -e "$DATADIR/tmp/bar/001-GIVEN-bar/bar.when"
! test -e "$DATADIR/tmp/bar/001-GIVEN-bar/bar.then"

test -e "$DATADIR/tmp/bar/002-WHEN-bar"
test -e "$DATADIR/tmp/bar/002-WHEN-bar/bar.given"
test -e "$DATADIR/tmp/bar/002-WHEN-bar/bar.when"
! test -e "$DATADIR/tmp/bar/002-WHEN-bar/bar.then"

test -e "$DATADIR/tmp/bar/003-THEN-bar"
test -e "$DATADIR/tmp/bar/003-THEN-bar/bar.given"
test -e "$DATADIR/tmp/bar/003-THEN-bar/bar.when"
test -e "$DATADIR/tmp/bar/003-THEN-bar/bar.then"

test -e "$DATADIR/tmp/foo/001-GIVEN-foo"
test -e "$DATADIR/tmp/foo/001-GIVEN-foo/foo.given"
! test -e "$DATADIR/tmp/foo/001-GIVEN-foo/foo.when"
! test -e "$DATADIR/tmp/foo/001-GIVEN-foo/foo.then"

test -e "$DATADIR/tmp/foo/002-WHEN-foo"
test -e "$DATADIR/tmp/foo/002-WHEN-foo/foo.given"
test -e "$DATADIR/tmp/foo/002-WHEN-foo/foo.when"
! test -e "$DATADIR/tmp/foo/002-WHEN-foo/foo.then"

test -e "$DATADIR/tmp/foo/003-THEN-foo"
test -e "$DATADIR/tmp/foo/003-THEN-foo/foo.given"
test -e "$DATADIR/tmp/foo/003-THEN-foo/foo.when"
test -e "$DATADIR/tmp/foo/003-THEN-foo/foo.then"