aboutsummaryrefslogtreecommitdiff
path: root/old-tests/variable
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-12-01 12:07:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-12-01 12:07:18 +0200
commit0ed86c76239d4f2904ea4ae1a77902a9e0db2a6d (patch)
tree5e8e1d43a0140f5739b21be7cbe120ebb9360d4f /old-tests/variable
parent12fc75188cc1f0a8c4c443c04e7a022131198c36 (diff)
Move old tests to old-tests/
Diffstat (limited to 'old-tests/variable')
-rw-r--r--old-tests/variable/dir-path/buildfile45
-rw-r--r--old-tests/variable/dir-path/test.out22
-rwxr-xr-xold-tests/variable/dir-path/test.sh3
-rw-r--r--old-tests/variable/expansion/buildfile26
-rw-r--r--old-tests/variable/expansion/test.out6
-rwxr-xr-xold-tests/variable/expansion/test.sh3
-rw-r--r--old-tests/variable/null/buildfile22
-rw-r--r--old-tests/variable/null/test.out7
-rwxr-xr-xold-tests/variable/null/test.sh3
-rw-r--r--old-tests/variable/override/build/bootstrap.build2
-rw-r--r--old-tests/variable/override/buildfile58
-rw-r--r--old-tests/variable/override/cache13
-rw-r--r--old-tests/variable/override/p/build/bootstrap.build1
-rw-r--r--old-tests/variable/override/p/buildfile49
-rw-r--r--old-tests/variable/override/p/loader1
-rw-r--r--old-tests/variable/override/simple3
-rwxr-xr-xold-tests/variable/override/test.sh312
-rw-r--r--old-tests/variable/prepend/buildfile14
-rw-r--r--old-tests/variable/prepend/test.out4
-rwxr-xr-xold-tests/variable/prepend/test.sh3
-rw-r--r--old-tests/variable/qualified/buildfile27
-rw-r--r--old-tests/variable/qualified/test.out12
-rwxr-xr-xold-tests/variable/qualified/test.sh3
-rw-r--r--old-tests/variable/representation/build/bootstrap.build4
-rw-r--r--old-tests/variable/representation/buildfile34
-rw-r--r--old-tests/variable/representation/driver.cxx10
-rw-r--r--old-tests/variable/representation/test.out20
-rwxr-xr-xold-tests/variable/representation/test.sh4
-rw-r--r--old-tests/variable/type-pattern-append/buildfile59
-rw-r--r--old-tests/variable/type-pattern-append/test.out7
-rwxr-xr-xold-tests/variable/type-pattern-append/test.sh3
-rw-r--r--old-tests/variable/type-pattern/buildfile39
-rw-r--r--old-tests/variable/type/buildfile84
-rw-r--r--old-tests/variable/type/test.out12
-rwxr-xr-xold-tests/variable/type/test.sh3
35 files changed, 918 insertions, 0 deletions
diff --git a/old-tests/variable/dir-path/buildfile b/old-tests/variable/dir-path/buildfile
new file mode 100644
index 0000000..5c99f07
--- /dev/null
+++ b/old-tests/variable/dir-path/buildfile
@@ -0,0 +1,45 @@
+# Untyped dir path reversability.
+#
+x = s/foo/bar/
+print -e=$x
+print -e $x
+
+y = $x
+print -e=$y
+print -e $y
+print
+
+# Typed dir path reversability and expansion.
+#
+x = [dir_path] foo/bar/
+print -I$x
+print -I$x/baz
+print -I $x
+print [strings] -I $x
+print -I $x/baz
+print
+
+y = $x # No longer typed but still not original.
+print -I$y
+print -I$y/baz
+print -I $y
+print [strings] -I $y
+print -I $y/baz
+print
+
+z = [strings] $x # Re-typed.
+print $z
+print
+
+# The root case.
+#
+r = [dir_path] /
+print $r/foo
+
+r += foo
+print [strings] $r
+
+r += bar
+print [strings] $r
+
+./:
diff --git a/old-tests/variable/dir-path/test.out b/old-tests/variable/dir-path/test.out
new file mode 100644
index 0000000..e608c42
--- /dev/null
+++ b/old-tests/variable/dir-path/test.out
@@ -0,0 +1,22 @@
+-e=s/foo/bar/
+-e s/foo/bar/
+-e=s/foo/bar/
+-e s/foo/bar/
+
+-Ifoo/bar
+-Ifoo/bar/baz
+-I foo/bar/
+-I foo/bar
+-I foo/bar/baz
+
+-Ifoo/bar
+-Ifoo/bar/baz
+-I foo/bar/
+-I foo/bar
+-I foo/bar/baz
+
+foo/bar
+
+//foo
+/foo
+/foo/bar
diff --git a/old-tests/variable/dir-path/test.sh b/old-tests/variable/dir-path/test.sh
new file mode 100755
index 0000000..c745b76
--- /dev/null
+++ b/old-tests/variable/dir-path/test.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+b -q | diff --strip-trailing-cr -u test.out -
diff --git a/old-tests/variable/expansion/buildfile b/old-tests/variable/expansion/buildfile
new file mode 100644
index 0000000..3f28372
--- /dev/null
+++ b/old-tests/variable/expansion/buildfile
@@ -0,0 +1,26 @@
+foo = FOO
+
+print $foo
+print $(foo)
+
+# Invalid.
+#
+#print $
+#print $()
+#print $(foo bar)
+#print $(foo{bar})
+
+# Indirect.
+#
+FOO = foo
+print $($FOO)
+print $($(FOO))
+print $($($FOO))
+
+# Quoted name.
+#
+"b a r" = BAR
+print $("b a r")
+#print $"b a r"
+
+./:
diff --git a/old-tests/variable/expansion/test.out b/old-tests/variable/expansion/test.out
new file mode 100644
index 0000000..5056f04
--- /dev/null
+++ b/old-tests/variable/expansion/test.out
@@ -0,0 +1,6 @@
+FOO
+FOO
+FOO
+FOO
+foo
+BAR
diff --git a/old-tests/variable/expansion/test.sh b/old-tests/variable/expansion/test.sh
new file mode 100755
index 0000000..c745b76
--- /dev/null
+++ b/old-tests/variable/expansion/test.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+b -q | diff --strip-trailing-cr -u test.out -
diff --git a/old-tests/variable/null/buildfile b/old-tests/variable/null/buildfile
new file mode 100644
index 0000000..3fa1a9e
--- /dev/null
+++ b/old-tests/variable/null/buildfile
@@ -0,0 +1,22 @@
+#v = [null=junk] # error: unexpected value for attribute null: junk
+#v = [null] junk # error: empty null value expected instead of 'junk'
+
+print $v0 # Undefined.
+
+v1 = [null]
+print $v1
+
+v2 = x
+v2 = [null]
+print $v2
+
+v3a = [null]
+v3b = $v3a
+print $v3b
+v3b = ($v3a)
+print $v3b
+print ($v3b)
+
+print [null]
+
+./:
diff --git a/old-tests/variable/null/test.out b/old-tests/variable/null/test.out
new file mode 100644
index 0000000..5119a71
--- /dev/null
+++ b/old-tests/variable/null/test.out
@@ -0,0 +1,7 @@
+[null]
+[null]
+[null]
+[null]
+[null]
+[null]
+[null]
diff --git a/old-tests/variable/null/test.sh b/old-tests/variable/null/test.sh
new file mode 100755
index 0000000..c745b76
--- /dev/null
+++ b/old-tests/variable/null/test.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+b -q | diff --strip-trailing-cr -u test.out -
diff --git a/old-tests/variable/override/build/bootstrap.build b/old-tests/variable/override/build/bootstrap.build
new file mode 100644
index 0000000..1c2e239
--- /dev/null
+++ b/old-tests/variable/override/build/bootstrap.build
@@ -0,0 +1,2 @@
+project = override
+amalgamation = # Disabled.
diff --git a/old-tests/variable/override/buildfile b/old-tests/variable/override/buildfile
new file mode 100644
index 0000000..c090e81
--- /dev/null
+++ b/old-tests/variable/override/buildfile
@@ -0,0 +1,58 @@
+if ($t != [null])
+{
+ [$t] v = [null]
+}
+
+print "/ :" $(/: v)
+
+if ($a == as)
+{
+ v = x
+}
+elif ($a == ap)
+{
+ v += s
+}
+elif ($a == pr)
+{
+ v =+ p
+}
+
+print ". :" $v
+
+d/:
+{
+ if ($d_a == as)
+ {
+ v = x
+ }
+ elif ($d_a == ap)
+ {
+ v += s
+ }
+ elif ($d_a == pr)
+ {
+ v =+ p
+ }
+
+ print "d :" $v
+
+
+ if ($d_t_a == as)
+ {
+ file{t}: v = x
+ }
+ elif ($d_t_a == ap)
+ {
+ file{t}: v += s
+ }
+ elif ($d_t_a == pr)
+ {
+ file{t}: v =+ p
+ }
+
+ print "d/t :" $(file{t}: v)
+}
+
+include p/
+./:
diff --git a/old-tests/variable/override/cache b/old-tests/variable/override/cache
new file mode 100644
index 0000000..8378688
--- /dev/null
+++ b/old-tests/variable/override/cache
@@ -0,0 +1,13 @@
+x = [string] 0
+print $x
+
+x = [uint64] 1
+print $x
+
+y = 0
+print $y
+
+[uint64] y = [null]
+print $y
+
+./:
diff --git a/old-tests/variable/override/p/build/bootstrap.build b/old-tests/variable/override/p/build/bootstrap.build
new file mode 100644
index 0000000..723e2a3
--- /dev/null
+++ b/old-tests/variable/override/p/build/bootstrap.build
@@ -0,0 +1 @@
+project = override-p
diff --git a/old-tests/variable/override/p/buildfile b/old-tests/variable/override/p/buildfile
new file mode 100644
index 0000000..527b9ae
--- /dev/null
+++ b/old-tests/variable/override/p/buildfile
@@ -0,0 +1,49 @@
+if ($p_a == as)
+{
+ v = x
+}
+elif ($p_a == ap)
+{
+ v += s
+}
+elif ($p_a == pr)
+{
+ v =+ p
+}
+
+print "p :" $v
+
+d/:
+{
+ if ($p_d_a == as)
+ {
+ v = x
+ }
+ elif ($p_d_a == ap)
+ {
+ v += s
+ }
+ elif ($p_d_a == pr)
+ {
+ v =+ p
+ }
+
+ print "p/d :" $v
+
+ if ($p_d_t_a == as)
+ {
+ file{t}: v = x
+ }
+ elif ($p_d_t_a == ap)
+ {
+ file{t}: v += s
+ }
+ elif ($p_d_t_a == pr)
+ {
+ file{t}: v =+ p
+ }
+
+ print "p/d/t :" $(file{t}: v)
+}
+
+./:
diff --git a/old-tests/variable/override/p/loader b/old-tests/variable/override/p/loader
new file mode 100644
index 0000000..f298dcc
--- /dev/null
+++ b/old-tests/variable/override/p/loader
@@ -0,0 +1 @@
+include ../buildfile
diff --git a/old-tests/variable/override/simple b/old-tests/variable/override/simple
new file mode 100644
index 0000000..899daa2
--- /dev/null
+++ b/old-tests/variable/override/simple
@@ -0,0 +1,3 @@
+print $foo
+
+./:
diff --git a/old-tests/variable/override/test.sh b/old-tests/variable/override/test.sh
new file mode 100755
index 0000000..a8b08b2
--- /dev/null
+++ b/old-tests/variable/override/test.sh
@@ -0,0 +1,312 @@
+#! /usr/bin/env bash
+
+verbose=n
+
+# By default when MSYS2 executable (bash.exe in particular) runs another
+# executable it converts arguments that look like POSIX paths to Windows
+# representations. More about it at:
+#
+# http://www.mingw.org/wiki/Posix_path_conversion
+#
+# So when you run b /v=X, build2 gets 'C:/msys64/v=X' argument instead of
+# '/v=X'. To disable this behavior set MSYS2_ARG_CONV_EXCL environment
+# variable, so all arguments starting with / will not be converted. You can
+# list more prefixes using ';' as a separator.
+#
+export MSYS2_ARG_CONV_EXCL=/
+
+tmp_file=`mktemp`
+
+# Remove temporary file on exit. Cover the case when exit due to an error.
+#
+trap 'rm -f $tmp_file' EXIT
+
+function error () { echo "$*" 1>&2; exit 1; }
+
+function fail ()
+{
+ if [ "$verbose" = "y" ]; then
+ b $*
+ else
+ b -q $* 2>/dev/null
+ fi
+
+ if [ $? -eq 0 ]; then
+ error "succeeded: b $*"
+ fi
+
+ return 0
+}
+
+function test ()
+{
+ b -q $* >$tmp_file
+
+ if [ $? -ne 0 ]; then
+ error "failed: b -q $* >$tmp_file"
+ fi
+
+ diff --strip-trailing-cr -u - $tmp_file
+
+ if [ $? -ne 0 ]; then
+ error "failed: b $*"
+ fi
+}
+
+fail foo=bar[] # error: unexpected [ in variable assignment 'foo=bar[]'
+fail foo=[string]bar # error: typed override of variable foo
+fail "!foo=bar" "!foo=BAR" # error: multiple global overrides of variable foo
+fail "foo=bar" "foo=BAR" # error: multiple project overrides of variable foo
+fail "%foo=bar" "%foo=BAR" # error: multiple project overrides of variable foo
+
+test --buildfile simple foo=bar ./ ./ <<< "bar" # Multiple bootstraps of the same project.
+
+# Visibility/qualification.
+#
+test !v=X <<EOF
+/ : X
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test v=X <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test ./:v=X <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test ./p/:v=X <<EOF
+/ :
+. :
+d :
+d/t :
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test v=X --buildfile loader ./p/ <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test /v=X <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test v=X p_a=as <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test %v=X <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test %v=X p_a=as <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : x
+p/d : x
+p/d/t : x
+EOF
+
+test /v=X d_a=as p_d_a=as <<EOF
+/ :
+. : X
+d : x
+d/t : x
+p : X
+p/d : x
+p/d/t : x
+EOF
+
+test %v+=S %v=+P a=as <<EOF
+/ :
+. : P x S
+d : P x S
+d/t : P x S
+p : P x S
+p/d : P x S
+p/d/t : P x S
+EOF
+
+test %v+=S %v=+P a=as p_a=as <<EOF
+/ :
+. : P x S
+d : P x S
+d/t : P x S
+p : x
+p/d : x
+p/d/t : x
+EOF
+
+# Append/Prepend in override.
+#
+test v+=S <<EOF
+/ :
+. : S
+d : S
+d/t : S
+p : S
+p/d : S
+p/d/t : S
+EOF
+
+test v+=S a=as <<EOF
+/ :
+. : x S
+d : x S
+d/t : x S
+p : x S
+p/d : x S
+p/d/t : x S
+EOF
+
+test %v=+P a=as p_a=as <<EOF
+/ :
+. : P x
+d : P x
+d/t : P x
+p : x
+p/d : x
+p/d/t : x
+EOF
+
+test %v+=S v=+P a=as p_a=as <<EOF
+/ :
+. : P x S
+d : P x S
+d/t : P x S
+p : P x
+p/d : P x
+p/d/t : P x
+EOF
+
+# Append/Prepend in both.
+#
+test v=X a=ap d_a=ap p_a=ap p_d_a=ap <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : X
+p/d : X
+p/d/t : X
+EOF
+
+test v+=S v=+P a=as d_a=ap d_t_a=ap p_a=ap p_d_a=ap p_d_t_a=ap <<EOF
+/ :
+. : P x S
+d : P x s S
+d/t : P x s s S
+p : P x s S
+p/d : P x s s S
+p/d/t : P x s s s S
+EOF
+
+# These ones are surprising. I guess the moral is we shouldn't do "blind"
+# cross-project append/prepend.
+#
+test %v=X a=as d_a=ap p_a=ap p_d_a=ap <<EOF
+/ :
+. : X
+d : X
+d/t : X
+p : x s
+p/d : x s s
+p/d/t : x s s
+EOF
+
+test %v+=S a=as d_a=ap p_a=ap p_d_a=ap <<EOF
+/ :
+. : x S
+d : x s S
+d/t : x s S
+p : x s
+p/d : x s s
+p/d/t : x s s
+EOF
+
+test %v+=S a=as d_a=ap p_a=ap p_d_a=ap ./ p/ <<EOF
+/ :
+. : x S
+d : x s S
+d/t : x s S
+p : x s S
+p/d : x s s S
+p/d/t : x s s S
+EOF
+
+# Typed override.
+#
+test v+=S v=+P t=string <<EOF
+/ :
+. : PS
+d : PS
+d/t : PS
+p : PS
+p/d : PS
+p/d/t : PS
+EOF
+
+test v+=S v=+P t=string a=as d_a=ap d_t_a=ap p_a=ap p_d_a=ap p_d_t_a=ap <<EOF
+/ :
+. : PxS
+d : PxsS
+d/t : PxssS
+p : PxsS
+p/d : PxssS
+p/d/t : PxsssS
+EOF
+
+# Cache overwrite.
+#
+test --buildfile cache x+=01 y+=01 <<EOF
+001
+2
+0 01
+1
+EOF
diff --git a/old-tests/variable/prepend/buildfile b/old-tests/variable/prepend/buildfile
new file mode 100644
index 0000000..896f99d
--- /dev/null
+++ b/old-tests/variable/prepend/buildfile
@@ -0,0 +1,14 @@
+foo =+ FOO
+print $foo
+
+foo =+ foo
+print $foo
+
+foo = foo
+print $foo
+
+foo =+ FOO
+foo += FOO
+print $foo
+
+./:
diff --git a/old-tests/variable/prepend/test.out b/old-tests/variable/prepend/test.out
new file mode 100644
index 0000000..80b77d0
--- /dev/null
+++ b/old-tests/variable/prepend/test.out
@@ -0,0 +1,4 @@
+FOO
+foo FOO
+foo
+FOO foo FOO
diff --git a/old-tests/variable/prepend/test.sh b/old-tests/variable/prepend/test.sh
new file mode 100755
index 0000000..c745b76
--- /dev/null
+++ b/old-tests/variable/prepend/test.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+b -q | diff --strip-trailing-cr -u test.out -
diff --git a/old-tests/variable/qualified/buildfile b/old-tests/variable/qualified/buildfile
new file mode 100644
index 0000000..870b808
--- /dev/null
+++ b/old-tests/variable/qualified/buildfile
@@ -0,0 +1,27 @@
+#v = (foo:) # error: variable name expected before ':'
+#v = (:bar) # error: scope/target expected after ':'
+
+print (foo:bar)
+print (foo :bar)
+print (foo: bar)
+print (foo : bar)
+print (foo/: bar)
+print (foo/file{fox}: bar)
+
+bar=bar
+sub/:
+{
+ bar=Bar
+ fsdir{./}: bar=BAR
+ file{x}: bar=BBAARR
+}
+
+print $(./:bar)
+print $(sub/:bar)
+print $(fsdir{sub/}:bar)
+print $(sub/file{x}:bar)
+
+print $(sub/file{y}:bar)
+print $(sup/:bar)
+
+./:
diff --git a/old-tests/variable/qualified/test.out b/old-tests/variable/qualified/test.out
new file mode 100644
index 0000000..5bf062e
--- /dev/null
+++ b/old-tests/variable/qualified/test.out
@@ -0,0 +1,12 @@
+foo:bar
+foo:bar
+foo:bar
+foo:bar
+foo/:bar
+foo/file{fox}:bar
+bar
+Bar
+BAR
+BBAARR
+Bar
+bar
diff --git a/old-tests/variable/qualified/test.sh b/old-tests/variable/qualified/test.sh
new file mode 100755
index 0000000..c745b76
--- /dev/null
+++ b/old-tests/variable/qualified/test.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+b -q | diff --strip-trailing-cr -u test.out -
diff --git a/old-tests/variable/representation/build/bootstrap.build b/old-tests/variable/representation/build/bootstrap.build
new file mode 100644
index 0000000..6a48e2e
--- /dev/null
+++ b/old-tests/variable/representation/build/bootstrap.build
@@ -0,0 +1,4 @@
+project = variable-representation
+amalgamation = # Disabled.
+using config
+using test
diff --git a/old-tests/variable/representation/buildfile b/old-tests/variable/representation/buildfile
new file mode 100644
index 0000000..b9c213d
--- /dev/null
+++ b/old-tests/variable/representation/buildfile
@@ -0,0 +1,34 @@
+# @@ I wonder if we can redo this test in terms of print?
+#
+
+# Test reversibility of variable representation.
+#
+val = -L/
+val += -L/foo/
+val += ..
+val += ../
+val += /
+val += //
+val += ///
+val += //foo/
+#val += dir{-L/}
+
+# Note that this is "reversed" when we assign it to test.options
+# since that variable is of type strings.
+#
+val += foo@bar foo/@bar/ foo@ @bar @ "@@"
+
+val += foo%bar
+val += foo%
+val += %bar
+val += foo%{bar}
+#val += foo%file{x}
+
+val += x%foo@y%bar
+val += x%foo/@y%bar/
+
+using cxx
+
+exe{driver}: cxx{driver}
+exe{driver}: test.output = test.out
+exe{driver}: test.options = $val
diff --git a/old-tests/variable/representation/driver.cxx b/old-tests/variable/representation/driver.cxx
new file mode 100644
index 0000000..ecff9e2
--- /dev/null
+++ b/old-tests/variable/representation/driver.cxx
@@ -0,0 +1,10 @@
+#include <iostream>
+
+using namespace std;
+
+int
+main (int argc, const char* argv[])
+{
+ for (int i (1); i < argc; ++i)
+ cout << "'" << argv[i] << "'" << endl;
+}
diff --git a/old-tests/variable/representation/test.out b/old-tests/variable/representation/test.out
new file mode 100644
index 0000000..84e7250
--- /dev/null
+++ b/old-tests/variable/representation/test.out
@@ -0,0 +1,20 @@
+'-L/'
+'-L/foo/'
+'..'
+'../'
+'/'
+'//'
+'///'
+'//foo/'
+'foo@bar'
+'foo/@bar/'
+'foo@'
+'@bar'
+'@'
+'@@'
+'foo%bar'
+'foo%'
+'%bar'
+'foo%bar'
+'x%foo@y%bar'
+'x%foo/@y%bar/'
diff --git a/old-tests/variable/representation/test.sh b/old-tests/variable/representation/test.sh
new file mode 100755
index 0000000..da9e0e9
--- /dev/null
+++ b/old-tests/variable/representation/test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+b test
+
diff --git a/old-tests/variable/type-pattern-append/buildfile b/old-tests/variable/type-pattern-append/buildfile
new file mode 100644
index 0000000..a91b340
--- /dev/null
+++ b/old-tests/variable/type-pattern-append/buildfile
@@ -0,0 +1,59 @@
+# Typed append/prepend.
+#
+#dir{a*}: x += [bool] true
+#dir{p*}: x =+ [bool] true
+
+[string] typed = [null]
+dir{a*}: typed += abc # ok
+dir{p*}: typed =+ abc # ok
+
+# Prepend/append before/after assignment.
+#
+[string] x1 = [null]
+dir{*}: x1 += A
+dir{*}: x1 = b
+dir{*}: x1 += c
+dir{*}: x1 =+ a
+print $(dir{./}:x1)
+
+# Without stem, mixed prepend/append.
+#
+dir{*}: x2 += b
+dir{*}: x2 += c
+#dir{*}: x2 =+ a # error
+print $(dir{./}:x2)
+
+dir{*}: x3 =+ b
+dir{*}: x3 =+ a
+#dir{*}: x3 += c # error
+print $(dir{./}:x3)
+
+# With stem, typing.
+#
+x4 = a
+dir{*}: x4 += b
+dir{*}: x4 += c
+print $(dir{./}:x4)
+
+[string] x5 = b
+dir{*}: x5 =+ a
+x = $(dir{./}:x5)
+print $(dir{./}:x5)
+
+x6 = [string] a
+sub/:
+{
+ dir{*}: x6 += b
+ dir{*}: x6 += [null]
+ print $(dir{./}:x6)
+}
+
+x7 = [string] b
+dir{*}: x7 =+ a
+sub/:
+{
+ dir{*}: x7 += c
+ print $(dir{./}:x7)
+}
+
+./:
diff --git a/old-tests/variable/type-pattern-append/test.out b/old-tests/variable/type-pattern-append/test.out
new file mode 100644
index 0000000..e8e2242
--- /dev/null
+++ b/old-tests/variable/type-pattern-append/test.out
@@ -0,0 +1,7 @@
+abc
+b c
+a b
+a b c
+ab
+ab
+abc
diff --git a/old-tests/variable/type-pattern-append/test.sh b/old-tests/variable/type-pattern-append/test.sh
new file mode 100755
index 0000000..c745b76
--- /dev/null
+++ b/old-tests/variable/type-pattern-append/test.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+b -q | diff --strip-trailing-cr -u test.out -
diff --git a/old-tests/variable/type-pattern/buildfile b/old-tests/variable/type-pattern/buildfile
new file mode 100644
index 0000000..dd218ac
--- /dev/null
+++ b/old-tests/variable/type-pattern/buildfile
@@ -0,0 +1,39 @@
+#dir/foo{*}: x = y # directory
+#foo{*.*}: x = y # multiple wildcards
+#foo{*}: x = y # unknown target type
+#file{*}: x += y # append
+
+# Use --verbose 6 to examine.
+#
+
+dir{*}: x = y
+
+x = z
+dir{*-foo}: x = $x # 'z'
+
+x = G
+file{*-foo}: x = x
+file{xfoo}: x = $x # 'G'
+file{-foo}: x = $x # 'x'
+file{x-foo}: x = $x # 'x'
+file{bar-*-foo}: x = X
+file{bar-x}: x = $x # 'G'
+file{bar--foo}: x = $x # 'X'
+file{bar-x-foo}: x = $x # 'X'
+
+file{*-fox}: x = 1
+file{fox-*}: x = 2
+file{fox-fox}: x = $x # '2'
+file{*-fox}: x = 3
+file{fox-x-fox}: x = $x # still '2'!
+
+*-foz: x = z # any target
+file{x-foz}: x = $x # 'z'
+
+# These should all be the same.
+#
+*: x1 = X1
+{*}: x2 = X2
+*{*}: x3 = X3
+
+./:
diff --git a/old-tests/variable/type/buildfile b/old-tests/variable/type/buildfile
new file mode 100644
index 0000000..a22cddd
--- /dev/null
+++ b/old-tests/variable/type/buildfile
@@ -0,0 +1,84 @@
+# Variable typing.
+#
+
+#[string] str3 = foo
+#[bool] str3 = false # error: changing str3 type from string to bool
+
+#[bool string] str3 = foo # error: multiple variable types: bool, string
+
+#[junk] jnk = foo # error: unknown variable attribute junk
+
+[string] str1 = bar
+str1 =+ foo
+str1 += baz
+print $str1
+
+str2 = bar
+[string] str2 =+ foo
+str2 += baz
+print $str2
+
+# Value typing.
+#
+
+#v = [bool string] true # error: multiple value types: string, bool
+#v = [string=junk] true # error: unexpected value for attribute string: junk
+
+#[string] var =
+#var = [bool] true # error: confliction variable var type string and value type bool
+
+#var = [string] false
+#var += [bool] true # error: confliction original value type string and append/prepend value type bool
+
+v1a = [uint64] 00
+v1b += [uint64] 00
+v1c =+ [uint64] 00
+print $v1a $v1b $v1c # 0 0 0
+
+v2 = [uint64] 00
+v2 = [string] 00
+print $v2 # 00
+
+#v3a = [uint64] 00
+#v3a += [string] 00 # error: confliction original value type uint64 and append/prepend value type string
+
+#v3b = [uint64] 00
+#v3b =+ [string] 00 # error: confliction original value type uint64 and append/prepend value type string
+
+v4a = 01
+v4a += [uint64] 01
+print $v4a # 2
+
+v4b = 01
+v4b =+ [uint64] 01
+print $v4b # 2
+
+v5a = 01
+sub/:
+{
+ v5a += [uint64] 01
+ print $v5a # 2
+}
+
+v5b = 01
+sub/:
+{
+ v5b =+ [uint64] 01
+ print $v5b # 2
+}
+
+v6 = [uint64 null]
+v6 += 00
+print $v6 # 0
+
+v7 = [string null]
+v7 += [uint64] 00
+print $v7 # 0
+
+print [uint64] 00 # 0
+
+v8 = [uint64] 01
+v8 = abc
+print $v8 # abc
+
+./:
diff --git a/old-tests/variable/type/test.out b/old-tests/variable/type/test.out
new file mode 100644
index 0000000..5218221
--- /dev/null
+++ b/old-tests/variable/type/test.out
@@ -0,0 +1,12 @@
+foobarbaz
+foobarbaz
+0 0 0
+00
+2
+2
+2
+2
+0
+0
+0
+abc
diff --git a/old-tests/variable/type/test.sh b/old-tests/variable/type/test.sh
new file mode 100755
index 0000000..c745b76
--- /dev/null
+++ b/old-tests/variable/type/test.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+b -q | diff --strip-trailing-cr -u test.out -