aboutsummaryrefslogtreecommitdiff
path: root/tests/variable/type
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-02 16:18:43 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-02 16:18:43 +0200
commit0e486cd3642da8a442629ffce9a3daf16745c35e (patch)
tree37dd2b40366598a68685168759543bc8abb4de80 /tests/variable/type
parent4bf42322fdd5dd7e01a3f61272bccc4a66a5585f (diff)
Implement variable typing (via attributes)
Now we can do: [string] str = foo
Diffstat (limited to 'tests/variable/type')
-rw-r--r--tests/variable/type/buildfile21
-rw-r--r--tests/variable/type/test.out2
-rwxr-xr-xtests/variable/type/test.sh3
3 files changed, 26 insertions, 0 deletions
diff --git a/tests/variable/type/buildfile b/tests/variable/type/buildfile
new file mode 100644
index 0000000..372b0ad
--- /dev/null
+++ b/tests/variable/type/buildfile
@@ -0,0 +1,21 @@
+# Variable typing.
+#
+[string] str1 = bar
+str1 =+ foo
+str1 += baz
+print $str1
+
+str2 = bar
+[string] str2 =+ foo
+str2 += baz
+print $str2
+
+#[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
+
+
+./:
diff --git a/tests/variable/type/test.out b/tests/variable/type/test.out
new file mode 100644
index 0000000..f5dfb84
--- /dev/null
+++ b/tests/variable/type/test.out
@@ -0,0 +1,2 @@
+foobarbaz
+foobarbaz
diff --git a/tests/variable/type/test.sh b/tests/variable/type/test.sh
new file mode 100755
index 0000000..afcb3bd
--- /dev/null
+++ b/tests/variable/type/test.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+b -q | diff -u test.out -