summaryrefslogtreecommitdiff
path: root/yarns/900-implements.yarn
diff options
context:
space:
mode:
Diffstat (limited to 'yarns/900-implements.yarn')
-rw-r--r--yarns/900-implements.yarn45
1 files changed, 44 insertions, 1 deletions
diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn
index cbf8ea4..a84f7c8 100644
--- a/yarns/900-implements.yarn
+++ b/yarns/900-implements.yarn
@@ -22,7 +22,7 @@ be, and changing there when running various commands.
IMPLEMENTS WHEN user changes working directory to (\S+)
printf "%s" "$MATCH_1" > "$DATADIR/cwd"
- IMPLEMENTS WHEN user attempts to run distix (.*)
+ IMPLEMENTS WHEN user attempts to run distix ([^$]*)
# Yarn sets $HOME to point at an empty temporary directory.
# Set up a simple git config so tests can use git.
@@ -42,6 +42,32 @@ be, and changing there when running various commands.
echo "$?" > "$DATADIR/attempt.exit"
fi
+ IMPLEMENTS WHEN user attempts to run distix show \$PREFIX
+b
+ # Yarn sets $HOME to point at an empty temporary directory.
+ # Set up a simple git config so tests can use git.
+ git config --global user.email 'Tomjon <tomjon@example.com>'
+ git config --global user.name 'Tomjon Tester'
+
+ cd "$DATADIR"
+ rm -f attempt.exit attempt.stdout attempt.stderr
+ cd "$(cat cwd || echo .)"
+ if "$SRCDIR/distix" --no-default-config --quiet \
+ --log "$DATADIR/distix.log" \
+ show "$(cat "$DATADIR/tid-prefix")"\
+ > "$DATADIR/attempt.stdout" 2> "$DATADIR/attempt.stderr"
+ then
+ echo 0 > "$DATADIR/attempt.exit"
+ else
+ echo "$?" > "$DATADIR/attempt.exit"
+ echo ============= distix stdout
+ cat "$DATADIR/attempt.stdout"
+ echo ============= distix stderr
+ cat "$DATADIR/attempt.stderr"
+ echo ============= distix output end
+ fi
+ exit 1
+
IMPLEMENTS WHEN user sets all tickets in (\S+) to (\S+)
cd "$DATADIR/$MATCH_1"
@@ -86,6 +112,12 @@ distix.
exit 1
fi
+ IMPLEMENTS THEN first ticket id is captured as \$TID
+ # We assume previous command run was distix list.
+ # Each line starts with a full ticket id.
+ head -n1 "$DATADIR/attempt.stdout" | awk '{print $1}' \
+ > "$DATADIR/ticket-id-1"
+
IMPLEMENTS THEN attempt failed
cat "$DATADIR/attempt.exit" # helps debugging scenarios
if grep -Fx 0 "$DATADIR/attempt.exit"
@@ -170,3 +202,14 @@ Check that everything is in git.
echo "Not everything is in git" 1>&2
exit 1
fi
+
+
+Ticket id manipulation
+----------------------
+
+ IMPLEMENTS THEN ticket id \$TID 7-nybble prefix is \$PREFIX
+ cut -c1-7 "$DATADIR/ticket-id-1" > "$DATADIR/tid-prefix"
+
+ IMPLEMENTS THEN output contains ticket id \$TID
+ grep -f "$DATADIR/ticket-id-1" "$DATADIR/attempt.stdout"
+