aboutsummaryrefslogtreecommitdiff
path: root/tests/name
diff options
context:
space:
mode:
Diffstat (limited to 'tests/name')
-rw-r--r--tests/name/cross.testscript1
-rw-r--r--tests/name/extension.testscript243
-rw-r--r--tests/name/pattern.testscript35
3 files changed, 255 insertions, 24 deletions
diff --git a/tests/name/cross.testscript b/tests/name/cross.testscript
index 84d0233..ab547d0 100644
--- a/tests/name/cross.testscript
+++ b/tests/name/cross.testscript
@@ -23,7 +23,6 @@ EOI
:
{
$* <'print {}{bar}' >'bar'
- $* <'print {foo}{}' >'foo{}'
$* <'print {foo}{bar}' >'foo{bar}'
$* <'print {foo}{bar baz}' >'foo{bar} foo{baz}'
$* <'print {foo fox}{bar}' >'foo{bar} fox{bar}'
diff --git a/tests/name/extension.testscript b/tests/name/extension.testscript
index 72721c2..6a542fe 100644
--- a/tests/name/extension.testscript
+++ b/tests/name/extension.testscript
@@ -16,46 +16,238 @@ EOI
: unspecified
:
touch foo.txt;
- $* <'./: txt{foo}'
+ $* <<EOI >>EOO
+ ./: txt{foo}
+ print $name(txt{foo})
+ print $extension(txt{foo})
+ print txt{fo?}
+ EOI
+ foo
+ [null]
+ txt{foo}
+ EOO
: specified
:
touch foo.text;
- $* <'./: txt{foo.text}'
+ $* <<EOI >>EOO
+ ./: txt{foo.text}
+ print $name(txt{foo.text})
+ print $extension(txt{foo.text})
+ print txt{fo?.text}
+ EOI
+ foo
+ text
+ txt{foo.text}
+ EOO
- : specified-none
+ : specified-triple
:
- touch foo;
- $* <'./: txt{foo.}'
+ touch fo.o.text;
+ $* <<EOI >>EOO
+ ./: txt{fo...o.text}
+ print $name(txt{fo...o.text})
+ print $extension(txt{fo...o.text})
+ print txt{f?...o.text}
+ EOI
+ fo
+ o.text
+ txt{fo...o.text}
+ EOO
- : specified-default
+ : multiple-triples
:
- touch foo.testscript.txt;
- $* <'./: txt{foo.testscript...}'
+ $* <'./: txt{f...o...o}' 2>>EOE != 0
+ <stdin>:1:5: error: multiple triple dots in target name 'f...o...o'
+ EOE
- # Trailing dots are not allowed on Windows.
- #
+ : multiple-singles
+ :
+ touch fo.o.text;
+ $* <<EOI >>EOO
+ ./: txt{fo.o.text}
+ print $name(txt{fo.o.text})
+ print $extension(txt{fo.o.text})
+ print txt{f?.o.text}
+ EOI
+ fo.o
+ text
+ txt{fo.o.text}
+ EOO
- : specified-escape-one
+ : escape-basename
+ :
+ touch fo.o.text;
+ $* <<EOI >>EOO
+ ./: txt{fo..o.text}
+ print $name(txt{fo..o.text})
+ print $extension(txt{fo..o.text})
+ print txt{f?..o.text}
+ EOI
+ fo.o
+ text
+ txt{fo.o.text}
+ EOO
+
+ : escape-extension
+ :
+ touch fo.o.text;
+ $* <<EOI >>EOO
+ ./: txt{fo.o..text}
+ print $name(txt{fo.o..text})
+ print $extension(txt{fo.o..text})
+ print txt{f?.o..text}
+ EOI
+ fo
+ o.text
+ txt{fo...o.text}
+ EOO
+
+ : trailing
:
- if ($cxx.target.class != 'windows')
{
- touch foo.;
- $* <'./: txt{foo..}'
+ : no-extension
+ :
+ touch foo;
+ $* <<EOI >>EOO
+ ./: txt{foo.}
+ print $name(txt{foo.})
+ print $extension(txt{foo.})
+ print txt{fo?.}
+ EOI
+ foo
+
+ txt{foo.}
+ EOO
+
+ : dot-no-extension
+ :
+ touch f.oo;
+ $* <<EOI >>EOO
+ ./: txt{f.oo.}
+ print $name(txt{f.oo.})
+ print $extension(txt{f.oo.})
+ print txt{f.o?.}
+ EOI
+ f.oo
+
+
+ EOO
+
+ : default-extension
+ :
+ touch foo.testscript.txt;
+ $* <<EOI >>EOO
+ ./: txt{foo.testscript...}
+ print $name(txt{foo.testscript...})
+ print $extension(txt{foo.testscript...})
+ print txt{fo?.testscript...}
+ EOI
+ foo.testscript
+ [null]
+ txt{foo.testscript...}
+ EOO
+
+ # Trailing dots are not allowed on Windows.
+ #
+
+ : escape-one
+ :
+ if ($cxx.target.class != 'windows')
+ {
+ touch foo.;
+ $* <<EOI >>EOO
+ ./: txt{foo..}
+ print $name(txt{foo..})
+ print $extension(txt{foo..})
+ print txt{fo?..}
+ EOI
+ foo.
+
+ txt{foo..}
+ EOO
+ }
+
+ : escape-two
+ :
+ if ($cxx.target.class != 'windows')
+ {
+ touch foo..;
+ $* <<EOI >>EOO
+ ./: txt{foo....}
+ print $name(txt{foo....})
+ print $extension(txt{foo....})
+ print txt{fo?....}
+ EOI
+ foo..
+
+ txt{foo....}
+ EOO
+ }
}
- : specified-escape-two
+ : leading
:
- if ($cxx.target.class != 'windows')
{
- touch foo..;
- $* <'./: txt{foo....}'
+ : single
+ :
+ touch .foo.txt;
+ $* <<EOI >>EOO
+ ./: txt{.foo}
+ print $name(txt{.foo})
+ print $extension(txt{.foo})
+ print txt{.fo?}
+ EOI
+ .foo
+ [null]
+ txt{.foo}
+ EOO
+
+ : triple
+ :
+ $* <'./: txt{...foo}' 2>>EOE != 0
+ <stdin>:1:5: error: leading triple dots in target name '...foo'
+ EOE
+
+ : escape-one
+ :
+ touch .foo.txt;
+ $* <<EOI >>EOO
+ ./: txt{..foo}
+ print $name(txt{..foo})
+ print $extension(txt{..foo})
+ print txt{..fo?}
+ EOI
+ .foo
+ [null]
+ txt{.foo}
+ EOO
+
+ : escape-two
+ :
+ touch ..foo.txt;
+ $* <<EOI >>EOO
+ ./: txt{....foo}
+ print $name(txt{....foo})
+ print $extension(txt{....foo})
+ print txt{....fo?}
+ EOI
+ ..foo
+ [null]
+ txt{....foo}
+ EOO
}
: specified-invalid
:
- $* <'./: txt{foo.....}' 2>>EOE != 0
- <stdin>:1:5: error: invalid trailing dot sequence in target name 'foo.....'
+ $* <'./: txt{fo.....o}' 2>>EOE != 0
+ <stdin>:1:5: error: invalid dot sequence in target name 'fo.....o'
+ EOE
+
+ : specified-dot-only
+ :
+ $* <'./: txt{..}' 2>>EOE != 0
+ <stdin>:1:5: error: invalid target name '..'
EOE
}
@@ -72,6 +264,17 @@ EOI
touch foo.testscript.txt;
$* <'print txt{fo?.testscript...}' >'txt{foo.testscript...}'
+ : dir
+ :
+ touch foo.txt;
+ $* <'print txt{./f*}' >'txt{./foo}'
+
+ : dir-leading-triple
+ :
+ $* <'print txt{./...f*}' 2>>EOE != 0
+ <stdin>:1:11: error: leading triple dots in target name './...f*'
+ EOE
+
# Trailing dots are not allowed on Windows.
#
diff --git a/tests/name/pattern.testscript b/tests/name/pattern.testscript
index 91fb98d..c1a4ce4 100644
--- a/tests/name/pattern.testscript
+++ b/tests/name/pattern.testscript
@@ -18,6 +18,35 @@ pat = '*'
print "$(pat).txt"
EOI
+: typed-concat
+:
+{
+ : dir-path
+ :
+ touch foo.txt;
+ $* <'print {$src_base/*.txt}' >/~'%.+/foo\.txt%'
+
+ : path
+ :
+ touch foo.txt;
+ $* <<EOI >/~'%.+/foo\.txt%'
+ p = [path] $src_base
+ print {$p/*.txt}
+ EOI
+
+ : string
+ :
+ touch foo.txt;
+ $* <<EOI >~'%.+/\*\.txt%'
+ p = [string] "$src_base"
+ print {$p/*.txt}
+ EOI
+
+ : not-pattern
+ :
+ $* <'print {$src_base/foo.txt}' >/~'%.+/foo\.txt%'
+}
+
: detect
:
: Test pattern_mode parsing logic.
@@ -332,13 +361,13 @@ EOI
:
{
mkdir dir;
- $* <'print $d' 'd=*/' >/'dir/' : dir
+ $* <'print $p.d' 'p.d=*/' >/'dir/' : dir
mkdir dir;
- $* <'print $d' 'd=dir{*}' >/'dir{dir/}' : dir-type
+ $* <'print $p.d' 'p.d=dir{*}' >/'dir{dir/}' : dir-type
touch foo.txt;
- $* <'print $f' 'f=*.txt' >'foo.txt' : feil
+ $* <'print $p.f' 'p.f=*.txt' >'foo.txt' : feil
}
: buildspec