aboutsummaryrefslogtreecommitdiff
path: root/tests/name/extension.test
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-08-07 14:59:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-08-07 19:32:10 +0200
commitc2b4305349ca855c497904282db354de56c74842 (patch)
tree13ff2901d1ab491d930f81cee6fa49e5cff11577 /tests/name/extension.test
parent7149c8eaeec3efcfc9da0f89c9ae979ff2c07fd5 (diff)
Add support for default extension specification, trailing dot escaping
For example: cxx{*}: extension = cxx cxx{foo} # foo.cxx cxx{foo.test} # foo.test (probably what we want...) cxx{foo.test...} # foo.test.cxx (... is this) cxx{foo..} # foo. cxx{foo....} # foo.. cxx{foo.....} # error (must come in escape pair)
Diffstat (limited to 'tests/name/extension.test')
-rw-r--r--tests/name/extension.test71
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/name/extension.test b/tests/name/extension.test
new file mode 100644
index 0000000..c7d7066
--- /dev/null
+++ b/tests/name/extension.test
@@ -0,0 +1,71 @@
+# file : tests/name/extension.test
+# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include ../common.test
+
++cat <<EOI >=build/root.build
+define txt: file
+txt{*}: extension = txt
+EOI
+
+: name
+:
+{
+ test.arguments = --match-only update
+
+ : unspecified
+ :
+ touch foo.txt;
+ $* <'./: txt{foo}'
+
+ : specified
+ :
+ touch foo.text;
+ $* <'./: txt{foo.text}'
+
+ : specified-none
+ :
+ touch foo;
+ $* <'./: txt{foo.}'
+
+ : specified-default
+ :
+ touch foo.test.txt;
+ $* <'./: txt{foo.test...}'
+
+ : specified-escape-one
+ :
+ touch foo.;
+ $* <'./: txt{foo..}'
+
+ : specified-escape-two
+ :
+ touch foo..;
+ $* <'./: txt{foo....}'
+
+ : specified-invalid
+ :
+ $* <'./: txt{foo.....}' 2>>EOE != 0
+ <stdin>:1:5: error: invalid trailing dot sequence in target name 'foo.....'
+ EOE
+}
+
+: pattern
+:
+{
+ : specified-none
+ :
+ touch foo;
+ $* <'print txt{fo?.}' >'txt{foo.}'
+
+ : specified-default
+ :
+ touch foo.test.txt;
+ $* <'print txt{fo?.test...}' >'txt{foo.test...}'
+
+ : specified-escape
+ :
+ touch foo.;
+ $* <'print txt{fo?..}' >'txt{foo..}'
+}