aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--old-tests/names/buildfile62
-rw-r--r--old-tests/names/test.out37
-rwxr-xr-xold-tests/names/test.sh3
-rwxr-xr-xold-tests/test.sh1
-rw-r--r--tests/name/buildfile2
-rw-r--r--tests/name/cross.test109
6 files changed, 110 insertions, 104 deletions
diff --git a/old-tests/names/buildfile b/old-tests/names/buildfile
deleted file mode 100644
index adeee15..0000000
--- a/old-tests/names/buildfile
+++ /dev/null
@@ -1,62 +0,0 @@
-# Name separation.
-#
-print foo {bar baz}
-print fox/ {bar baz}
-print fox/foo {bar baz}
-
-# Name "crosses".
-#
-print {}{bar} # Same as bar.
-print {foo}{} # Same as foo{} (empty name of type foo).
-print foo{} # For compatiron.
-print {foo}{bar}
-print {foo}{bar baz}
-print {foo fox}{bar}
-print {foo fox}{bar baz}
-
-print dir/{}{bar} # Same as dir/bar.
-print dir/{foo}{} # Same as dir/foo{} (directory of type foo).
-print dir/foo{} # For comparison.
-print dir/{foo}{bar}
-print dir/{foo}{bar baz}
-print dir/{foo fox}{bar}
-print dir/{foo fox}{bar baz}
-
-print {dir/}{bar}
-print {dir/}{bar baz}
-print {dir/ dor/}{bar}
-print {dir/ dor/}{bar baz}
-
-print {dir/foo}{bar}
-print {dir/foo}{bar baz}
-print {dir/foo dor/fox}{bar}
-print {dir/foo dor/fox}{bar baz}
-
-print {dir/}{foo}{bar}
-print {dir/}{foo}{bar baz}
-print {dir/ dor/}{foo}{bar}
-print {dir/ dor/}{foo fox}{bar baz}
-
-print {prj%foo}{bar baz}
-print {foo}{bar prj%baz}
-#print {prj%foo}{bar prk%baz} # nested project name
-
-print dir/{foo}{bar baz}
-print {foo}{bar dir/{baz}}
-print dir/{foo}{bar dor/{baz}}
-
-print {dir/foo{}}{bar}
-print {dir/{foo}}{bar}
-print {dir/}{foo{bar}}
-#print {dir/foo{fox}}{bar} # nested type name
-#print {dir/foo}{fox{bar}} # nested type name
-
-# Nested replay.
-#
-#file{foo} file{bar}: x = {foo fox}{bar baz}
-
-# Pair.
-#
-print x@{dir/ dor/}{foo fox}{bar baz}
-
-./:
diff --git a/old-tests/names/test.out b/old-tests/names/test.out
deleted file mode 100644
index 280c372..0000000
--- a/old-tests/names/test.out
+++ /dev/null
@@ -1,37 +0,0 @@
-foo bar baz
-fox/ bar baz
-fox/foo bar baz
-bar
-foo{}
-foo{}
-foo{bar}
-foo{bar} foo{baz}
-foo{bar} fox{bar}
-foo{bar} fox{bar} foo{baz} fox{baz}
-dir/bar
-foo{dir/}
-foo{dir/}
-dir/foo{bar}
-dir/foo{bar} dir/foo{baz}
-dir/foo{bar} dir/fox{bar}
-dir/foo{bar} dir/fox{bar} dir/foo{baz} dir/fox{baz}
-dir/bar
-dir/bar dir/baz
-dir/bar dor/bar
-dir/bar dor/bar dir/baz dor/baz
-dir/foo{bar}
-dir/foo{bar} dir/foo{baz}
-dir/foo{bar} dor/fox{bar}
-dir/foo{bar} dor/fox{bar} dir/foo{baz} dor/fox{baz}
-dir/foo{bar}
-dir/foo{bar} dir/foo{baz}
-dir/foo{bar} dor/foo{bar}
-dir/foo{bar} dor/foo{bar} dir/fox{bar} dor/fox{bar} dir/foo{baz} dor/foo{baz} dir/fox{baz} dor/fox{baz}
-prj%foo{bar} prj%foo{baz}
-foo{bar} prj%foo{baz}
-dir/foo{bar} dir/foo{baz}
-foo{bar} dir/foo{baz}
-dir/foo{bar} dir/dor/foo{baz}
-dir/foo{bar}
-dir/foo{bar}
-dir/foo{bar}
diff --git a/old-tests/names/test.sh b/old-tests/names/test.sh
deleted file mode 100755
index c745b76..0000000
--- a/old-tests/names/test.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-b -q | diff --strip-trailing-cr -u test.out -
diff --git a/old-tests/test.sh b/old-tests/test.sh
index 6a8e39c..f02291a 100755
--- a/old-tests/test.sh
+++ b/old-tests/test.sh
@@ -16,7 +16,6 @@ test "amalgam/unnamed"
test "escaping"
test "if-else"
test "keyword"
-test "names"
test "pairs"
test "quote"
test "scope"
diff --git a/tests/name/buildfile b/tests/name/buildfile
index 8eaf31e..5b368bb 100644
--- a/tests/name/buildfile
+++ b/tests/name/buildfile
@@ -2,4 +2,4 @@
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-./: test{pattern} $b
+./: test{cross pattern} $b
diff --git a/tests/name/cross.test b/tests/name/cross.test
new file mode 100644
index 0000000..04da551
--- /dev/null
+++ b/tests/name/cross.test
@@ -0,0 +1,109 @@
+# file : tests/name/cross.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include ../common.test
+
++cat <<EOI >=build/root.build
+define foo: file
+define bar: file
+
+foo{*}: extension = foo
+bar{*}: extension = bar
+EOI
+
+: separation
+:
+{
+ $* <'print fox/ {bar baz}' >'fox/ bar baz' : dir
+ $* <'print foo {bar baz}' >'foo bar baz' : type
+ $* <'print fox/foo {bar baz}' >'fox/foo bar baz' : dir-type
+}
+
+: type
+:
+{
+ $* <'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}'
+ $* <'print {foo fox}{bar baz}' >'foo{bar} foo{baz} fox{bar} fox{baz}'
+}
+
+: dir
+:
+{
+ $* <'print dir/{}{bar}' >'dir/bar'
+ $* <'print dir/{foo}{}' >'foo{dir/}'
+ $* <'print dir/{foo}{bar}' >'dir/foo{bar}'
+ $* <'print dir/{foo}{bar baz}' >'dir/foo{bar} dir/foo{baz}'
+ $* <'print dir/{foo fox}{bar}' >'dir/foo{bar} dir/fox{bar}'
+ $* <'print dir/{foo fox}{bar baz}' >'dir/foo{bar} dir/foo{baz} dir/fox{bar} dir/fox{baz}'
+
+ $* <'print {dir/}{bar}' >'dir/bar'
+ $* <'print {dir/}{bar baz}' >'dir/bar dir/baz'
+ $* <'print {dir/ dor/}{bar}' >'dir/bar dor/bar'
+ $* <'print {dir/ dor/}{bar baz}' >'dir/bar dir/baz dor/bar dor/baz'
+}
+
+: dir-type
+:
+{
+ $* <'print {dir/foo}{bar}' >'dir/foo{bar}'
+ $* <'print {dir/foo}{bar baz}' >'dir/foo{bar} dir/foo{baz}'
+ $* <'print {dir/foo dor/fox}{bar}' >'dir/foo{bar} dor/fox{bar}'
+ $* <'print {dir/foo dor/fox}{bar baz}' >'dir/foo{bar} dir/foo{baz} dor/fox{bar} dor/fox{baz}'
+
+ $* <'print {dir/}{foo}{bar}' >'dir/foo{bar}'
+ $* <'print {dir/}{foo}{bar baz}' >'dir/foo{bar} dir/foo{baz}'
+ $* <'print {dir/ dor/}{foo}{bar}' >'dir/foo{bar} dor/foo{bar}'
+ $* <'print {dir/ dor/}{foo fox}{bar baz}' >'dir/foo{bar} dir/foo{baz} dir/fox{bar} dir/fox{baz} dor/foo{bar} dor/foo{baz} dor/fox{bar} dor/fox{baz}'
+}
+
+: proj
+:
+{
+ $* <'print {prj%foo}{bar baz}' >'prj%foo{bar} prj%foo{baz}'
+ $* <'print {foo}{bar prj%baz}' >'foo{bar} prj%foo{baz}'
+
+ $* <'print {prj%foo}{bar prk%baz}' 2>>EOE != 0
+ <stdin>:1:21: error: nested project name prk
+ EOE
+}
+
+: merge
+:
+{
+ $* <'print {foo}{bar dir/{baz}}' >'foo{bar} dir/foo{baz}'
+ $* <'print dir/{foo}{bar dor/{baz}}' >'dir/foo{bar} dir/dor/foo{baz}'
+
+ $* <'print {dir/foo{}}{bar}' >'dir/foo{bar}'
+ $* <'print {dir/{foo}}{bar}' >'dir/foo{bar}'
+ $* <'print {dir/}{foo{bar}}' >'dir/foo{bar}'
+
+ $* <'print {dir/foo{fox}}{bar}' 2>>EOE != 0
+ <stdin>:1:22: error: nested type name fox
+ EOE
+
+ $* <'print {dir/foo}{fox{bar}}' 2>>EOE != 0
+ <stdin>:1:20: error: nested type name fox
+ EOE
+}
+
+: pair
+:
+{
+ $* <'print x@{dir/ dor/}{foo fox}{bar baz}' >'x@dir/foo{bar} x@dir/foo{baz} x@dir/fox{bar} x@dir/fox{baz} x@dor/foo{bar} x@dor/foo{baz} x@dor/fox{bar} x@dor/fox{baz}'
+}
+
+: pattern
+:
+{
+ touch x.foo y.bar;
+ $* <'print {foo bar}{*}' >'foo{x} bar{y}'
+}
+
+# @@ TODO: nested replay.
+#
+#file{foo} file{bar}: x = {foo fox}{bar baz}