aboutsummaryrefslogtreecommitdiff
path: root/test cases/common/69 string arithmetic
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@karoshi.org.uk>2014-11-08 01:41:05 +0000
committerRobin McCorkell <rmccorkell@karoshi.org.uk>2014-11-16 16:45:10 +0000
commit702148aea515b5c7b2d6004615a7f4a635a7ca1e (patch)
tree7594171a735bea6ac32cdd5da337dfbeee789e92 /test cases/common/69 string arithmetic
parent9ce01c16f409208ca17235efee602a71da9712de (diff)
downloadmeson-702148aea515b5c7b2d6004615a7f4a635a7ca1e.zip
meson-702148aea515b5c7b2d6004615a7f4a635a7ca1e.tar.gz
meson-702148aea515b5c7b2d6004615a7f4a635a7ca1e.tar.bz2
Add number, string and array arithmetic
Addition (+), subtraction (-), multiplication (*) and division (/) for numbers follows the BIDMAS rules. Strings and arrays can be concatenated with the addition operator Strings can be concatenated with numbers with the addition operator
Diffstat (limited to 'test cases/common/69 string arithmetic')
-rw-r--r--test cases/common/69 string arithmetic/meson.build20
1 files changed, 20 insertions, 0 deletions
diff --git a/test cases/common/69 string arithmetic/meson.build b/test cases/common/69 string arithmetic/meson.build
new file mode 100644
index 0000000..f0e46e9
--- /dev/null
+++ b/test cases/common/69 string arithmetic/meson.build
@@ -0,0 +1,20 @@
+project('string arithmetic', 'c')
+
+if 'foo' + 'bar' != 'foobar'
+ error('String concatenation is broken')
+endif
+
+if 'foo' + 'bar' + 'baz' != 'foobarbaz'
+ error('Many-string concatenation is broken')
+endif
+
+if 'foobar' + 5 != 'foobar5' or 5 + 'foobar' != '5foobar'
+ error('String-number concatenation is broken')
+endif
+
+if (5 + 3) + 'foobar' != '8foobar'
+ error('String-number addition then concatenation broken')
+endif
+if 5 + (3 + 'foobar') != '53foobar'
+ error('String-number concatenation then addition broken')
+endif