summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-02-26 21:37:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-02-26 21:37:10 (GMT)
commit26f7b5c79ace2df0475f8d04d1a5141e21615ddd (patch)
tree203d287c3affddfdd3d01624cf43fd4732d336de /t
parentae2f25542ffdd1919b33c8f274f8172e49d64dbf (diff)
parentfe63c4d110acd348244bb0065518a62a1a8dbb00 (diff)
downloadgit-26f7b5c79ace2df0475f8d04d1a5141e21615ddd.zip
git-26f7b5c79ace2df0475f8d04d1a5141e21615ddd.tar.gz
git-26f7b5c79ace2df0475f8d04d1a5141e21615ddd.tar.bz2
Merge branch 'kn/ref-filter-atom-parsing'
The ref-filter's format-parsing code has been refactored, in preparation for "branch --format" and friends. * kn/ref-filter-atom-parsing: ref-filter: introduce objectname_atom_parser() ref-filter: introduce contents_atom_parser() ref-filter: introduce remote_ref_atom_parser() ref-filter: align: introduce long-form syntax ref-filter: introduce align_atom_parser() ref-filter: introduce parse_align_position() ref-filter: introduce color_atom_parser() ref-filter: introduce parsing functions for each valid atom ref-filter: introduce struct used_atom ref-filter: bump 'used_atom' and related code to the top ref-filter: use string_list_split over strbuf_split
Diffstat (limited to 't')
-rwxr-xr-xt/t6302-for-each-ref-filter.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh
index fe4796c..bcf472b 100755
--- a/t/t6302-for-each-ref-filter.sh
+++ b/t/t6302-for-each-ref-filter.sh
@@ -133,6 +133,48 @@ test_expect_success 'right alignment' '
test_cmp expect actual
'
+cat >expect <<-\EOF
+| refname is refs/heads/master |refs/heads/master
+| refname is refs/heads/side |refs/heads/side
+| refname is refs/odd/spot |refs/odd/spot
+| refname is refs/tags/double-tag |refs/tags/double-tag
+| refname is refs/tags/four |refs/tags/four
+| refname is refs/tags/one |refs/tags/one
+| refname is refs/tags/signed-tag |refs/tags/signed-tag
+| refname is refs/tags/three |refs/tags/three
+| refname is refs/tags/two |refs/tags/two
+EOF
+
+test_align_permutations() {
+ while read -r option
+ do
+ test_expect_success "align:$option" '
+ git for-each-ref --format="|%(align:$option)refname is %(refname)%(end)|%(refname)" >actual &&
+ test_cmp expect actual
+ '
+ done
+}
+
+test_align_permutations <<-\EOF
+ middle,42
+ 42,middle
+ position=middle,42
+ 42,position=middle
+ middle,width=42
+ width=42,middle
+ position=middle,width=42
+ width=42,position=middle
+EOF
+
+# Last one wins (silently) when multiple arguments of the same type are given
+
+test_align_permutations <<-\EOF
+ 32,width=42,middle
+ width=30,42,middle
+ width=42,position=right,middle
+ 42,right,position=middle
+EOF
+
# Individual atoms inside %(align:...) and %(end) must not be quoted.
test_expect_success 'alignment with format quote' "