summaryrefslogtreecommitdiff
path: root/clab.yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2013-10-05 13:58:14 +0100
committerLars Wirzenius <liw@liw.fi>2013-10-05 13:58:14 +0100
commitf34f2a23b355f020759f714eb8fb567871de587c (patch)
treeac5c2bca815b4cb4c770ed4ccbb2775adf4e9784 /clab.yarn
parent5b042d5679e1d61e432bd7812ac81d45a574dcda (diff)
downloadclab-f34f2a23b355f020759f714eb8fb567871de587c.tar.gz
Output each name/addr only once with mutt-query
Diffstat (limited to 'clab.yarn')
-rw-r--r--clab.yarn23
1 files changed, 23 insertions, 0 deletions
diff --git a/clab.yarn b/clab.yarn
index 234777c..745eb09 100644
--- a/clab.yarn
+++ b/clab.yarn
@@ -60,6 +60,15 @@ Put several records in one file.
AND Bob is not found
AND bob@example.com is not found
+Sometimes the same person is in the database multiple times
+(e.g., different records for home and work personas, where the
+work persona is automatically generated from LDAP or something).
+In this case, only find each person once.
+
+ GIVEN another record for Alice (alice@example.com)
+ WHEN mutt-querying for example
+ THEN Alice is found only once
+
Implementation
--------------
@@ -82,6 +91,12 @@ These implement the various steps.
email: $MATCH_4
EOF
+ IMPLEMENTS GIVEN another record for (\S+) \((\S+)\)
+ cat << EOF >> "$DATADIR/db/foo.yaml"
+ - name: $MATCH_1
+ email: $MATCH_2
+ EOF
+
IMPLEMENTS WHEN listing all records
./clab --no-default-config --db "$DATADIR/db" list > "$DATADIR/output"
@@ -106,5 +121,13 @@ These implement the various steps.
set -x
grep -F "$MATCH_1" "$DATADIR/output"
+ IMPLEMENTS THEN (.*) is found only once
+ n=$(grep -cF "$MATCH_1" "$DATADIR/output")
+ if [ "$n" != 1 ]
+ then
+ echo "$MATCH_1 was found $n times, expected 1" 1>&2
+ exit 1
+ fi
+
IMPLEMENTS THEN (.*) is not found
! grep -F "$MATCH_1" "$DATADIR/output"