diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-06-05 22:05:17 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-06-05 22:05:17 +0100 |
commit | 0df12510208bc1394ff52e89dcc195916450a1e3 (patch) | |
tree | 96f09060eb6c011037b76b2dbf978d367914e15e /yarns | |
parent | c2d477bbf13f9106a2c8964469d64d84eceffaa7 (diff) | |
download | distix-0df12510208bc1394ff52e89dcc195916450a1e3.tar.gz |
Add yarn for distix list search pattern
Diffstat (limited to 'yarns')
-rw-r--r-- | yarns/070-search.yarn | 54 | ||||
-rw-r--r-- | yarns/900-implements.yarn | 8 |
2 files changed, 62 insertions, 0 deletions
diff --git a/yarns/070-search.yarn b/yarns/070-search.yarn new file mode 100644 index 0000000..0308327 --- /dev/null +++ b/yarns/070-search.yarn @@ -0,0 +1,54 @@ +Search tickets +============== + +`distix list` lets the user limit the list of tickets it shows using a +query language. For now, the search language is very simplistic: it +only allows a query of the form `foo!=bar`, where `foo` and `bar` form +a key/value pair and the query matches if `foo` does __not__ have a +value `bar`. This is useful for listing open tickets: `distix list +state!=closed`. Tickets do not, by default, have a `state` key, but +they can be marked closed by setting one. + +The search language will be improved later. The purpose of the simple +approach is to get `distix` into a form that can be used for real in +real projects as soon as possible. + + SCENARIO list finds only open tickets + +First, create two tickets with different titles. + + WHEN user attempts to run distix init REPO + THEN attempt succeeded + + WHEN user changes working directory to REPO + AND user attempts to run distix new first-ticket --save-ticket-id=T1 + THEN attempt succeeded + + WHEN user attempts to run distix new second-ticket --save-ticket-id=T2 + THEN attempt succeeded + +Make sure `distix list` shows both tickets. + + WHEN user attempts to run distix list + THEN attempt succeeded + AND output matches "first-ticket" + AND output matches "second-ticket" + +Set the second ticket's state to closed, and make sure `distix list` +still shows both tickets. + + WHEN user attempts to run distix set --ticket-id-from=T2 DUMMY state=closed + THEN attempt succeeded + + WHEN user attempts to run distix list + THEN attempt succeeded + AND output matches "first-ticket" + AND output matches "second-ticket" + +However, if we search for open tickets, only the first ticket should +be listed. + + WHEN user attempts to run distix list state!=closed + THEN attempt succeeded + AND output matches "first-ticket" + AND output doesn't match "second-ticket" diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn index a715344..c08a1e8 100644 --- a/yarns/900-implements.yarn +++ b/yarns/900-implements.yarn @@ -63,6 +63,14 @@ distix. cat "$DATADIR/attempt.stdout" grep -P -e "$MATCH_1" "$DATADIR/attempt.stdout" + IMPLEMENTS THEN output doesn't match "(.*)" + cat "$DATADIR/attempt.stdout" + if grep -P -e "$MATCH_1" "$DATADIR/attempt.stdout" + then + echo "$DATADIR/attempt.stdout unexpected matches $MATCH_1" 1>&2 + exit 1 + fi + IMPLEMENTS THEN attempt failed cat "$DATADIR/attempt.exit" # helps debugging scenarios if grep -Fx 0 "$DATADIR/attempt.exit" |