1#!/bin/sh
2
3set -eu
4
5cat << 'EOF' > "$DATADIR/env.yarn"
6    SCENARIO check environment
7    THEN DATADIR is set
8    AND SRCDIR is set
9    AND NOTSET is not set
10    AND HOME is prefixed by DATADIR
11
12    IMPLEMENTS THEN (\S+) is set
13    env
14    env | grep "^$MATCH_1="
15
16    IMPLEMENTS THEN (\S+) is not set
17    ! env | grep "^$MATCH_1="
18
19    IMPLEMENTS THEN (\S+) is prefixed by (\S+)
20    x=$(env | sed -n "/^$MATCH_2=/s///p")
21    env | grep "^$MATCH_1=$x/"
22EOF
23
24NOTSET=foo ./run-yarn "$DATADIR/env.yarn"
25