aboutsummaryrefslogtreecommitdiff
path: root/tests/name
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-09-26 02:17:48 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-09-29 23:02:03 +0300
commitef1459feaf422fbbb069f2525547ef9b2204ccdf (patch)
tree4253606a7513b9465f5d7eabff0be6555c5f0794 /tests/name
parent1dc020cb957943c5c5c5364613061fedb50b9d9f (diff)
Allow pattern group to start with inclusion
Diffstat (limited to 'tests/name')
-rw-r--r--tests/name/pattern.test114
1 files changed, 85 insertions, 29 deletions
diff --git a/tests/name/pattern.test b/tests/name/pattern.test
index b5b0bea..00838d0 100644
--- a/tests/name/pattern.test
+++ b/tests/name/pattern.test
@@ -45,13 +45,19 @@ EOI
: simple
:
$* <'print {*.txt +foo file{bar}}' 2>>EOE != 0
- <stdin>:1:8: error: invalid 'file{bar}' in name pattern
+ <stdin>:1:19: error: name pattern inclusion or exclusion expected
EOE
: inclusion-exclusion-sign
:
$* <'print {*.txt -foo bar}' 2>>EOE != 0
- <stdin>:1:8: error: missing leading +/- in 'bar' name pattern
+ <stdin>:1:19: error: name pattern inclusion or exclusion expected
+ EOE
+
+ : inclusion-quoted
+ :
+ $* <'print {*.txt -foo "+bar"}' 2>>EOE != 0
+ <stdin>:1:19: error: name pattern inclusion or exclusion expected
EOE
: empty-inclusion-exclusion
@@ -79,6 +85,9 @@ EOI
touch foo.txt;
$* <'print {*.txt}' >'foo.txt' : group
+ touch foo.txt;
+ $* <'print {+*.txt}' >'foo.txt' : plus-prefixed
+
mkdir dir && touch dir/foo.txt;
$* <'print dir/{*.txt}' >'dir/foo.txt' : dir
@@ -190,38 +199,85 @@ EOI
# print dir1/{$pat}
# print dir2/{$pat}
#
+ # Instead, he should write it as follows:
+ #
+ # pat = '*.txt'
+ # print dir1/{+$pat}
+ # print dir2/{+$pat}
+ #
# Note that if we make it work, escaping this case will be pretty hairy:
#
# filters = --include '*.txt' --exclude '*.obj'
# options += $filters
- #: pattern-via-expansion
- #:
- #$* <<EOI >'<*.txt>'
- #pat = '*.txt'
- #print $pat
- #EOI
-
- #: pattern-via-expansion-list
- #:
- #$* <<EOI >'<*.hxx+*.txt>'
- #pats = '*.hxx' '+*.txt'
- #print {$pats}
- #EOI
-
- #: pattern-via-expansion-type
- #:
- #$* <<EOI >'<*.txt>'
- #pat = '*.txt'
- #print txt{$pat}
- #EOI
-
- #: pattern-via-expansion-dir
- #:
- #$* <<EOI >'<*.txt>'
- #pat = '*.txt'
- #print dir/{$pat}
- #EOI
+ : prefixed-pattern-via-expansion
+ :
+ : Pattern is prefixed with the literal unquoted plus character, that is
+ : stripped.
+ :
+ touch foo.txt;
+ $* <<EOI >foo.txt
+ pat = '*.txt'
+ print {+$pat}
+ EOI
+
+ : non-prefixed-pattern-via-concat-expansion
+ :
+ : Plus character is a part of the pattern and so is not stripped.
+ :
+ touch +foo.txt;
+ $* <<EOI >'+foo.txt'
+ pat = '+*'
+ ext = 'txt'
+ print {$pat.$ext}
+ EOI
+
+ : not-pattern-expansion
+ :
+ $* <<EOI >'+*.txt'
+ pat = '+*.txt'
+ print {$pat}
+ EOI
+
+ : not-pattern-quoted
+ :
+ $* <<EOI >'+*.txt'
+ print {'+*.txt'}
+ EOI
+
+ : pattern-via-expansion-list
+ :
+ touch foo.txt bar.hxx;
+ $* <<EOI >'bar.hxx foo.txt'
+ pats = '*.hxx' '*.txt'
+ print {+{$pats}}
+ EOI
+
+ : pattern-via-expansion-type
+ :
+ touch foo.txt;
+ $* <<EOI >'txt{foo}'
+ pat = '*'
+ print txt{+$pat}
+ EOI
+
+ : pattern-via-expansion-dir
+ :
+ mkdir dir;
+ touch dir/foo.txt;
+ $* <<EOI >dir/foo.txt
+ pat = '*.txt'
+ print dir/{+$pat}
+ EOI
+
+ : pattern-via-expansion-dir-type
+ :
+ mkdir dir;
+ touch dir/foo.txt;
+ $* <<EOI >dir/txt{foo}
+ pat = '*'
+ print dir/txt{+$pat}
+ EOI
: pattern-via-concat
: