aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2017-04-30 04:33:31 -0400
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2017-05-05 17:23:34 -0400
commitabd02b3eae13e151143f64164c65571da4ff2d42 (patch)
tree20bdc0ec5cdee455095466d74ef8674da1ba9331
parent7d6c6fe166bb2005c3ea22e07308df854c139ee2 (diff)
downloadmeson-abd02b3eae13e151143f64164c65571da4ff2d42.zip
meson-abd02b3eae13e151143f64164c65571da4ff2d42.tar.gz
meson-abd02b3eae13e151143f64164c65571da4ff2d42.tar.bz2
Add test case for ninja quoting.
-rw-r--r--test cases/common/149 special characters/check_quoting.py28
-rw-r--r--test cases/common/149 special characters/installed_files.txt2
-rw-r--r--test cases/common/149 special characters/meson.build37
3 files changed, 67 insertions, 0 deletions
diff --git a/test cases/common/149 special characters/check_quoting.py b/test cases/common/149 special characters/check_quoting.py
new file mode 100644
index 0000000..d6e50ea
--- /dev/null
+++ b/test cases/common/149 special characters/check_quoting.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+
+import sys
+
+expected = {
+ 'newline': '\n',
+ 'dollar': '$',
+ 'colon': ':',
+ 'space': ' ',
+ 'multi1': ' ::$$ ::$$',
+ 'multi2': ' ::$$\n\n \n\n::$$',
+}
+
+output = None
+
+for arg in sys.argv[1:]:
+ try:
+ name, value = arg.split('=', 1)
+ except ValueError:
+ output = arg
+ continue
+
+ if expected[name] != value:
+ raise RuntimeError('{!r} is {!r} but should be {!r}'.format(name, value, expected[name]))
+
+if output is not None:
+ with open(output, 'w') as f:
+ f.write('Success!')
diff --git a/test cases/common/149 special characters/installed_files.txt b/test cases/common/149 special characters/installed_files.txt
new file mode 100644
index 0000000..f677881
--- /dev/null
+++ b/test cases/common/149 special characters/installed_files.txt
@@ -0,0 +1,2 @@
+usr/share/result
+usr/share/result2
diff --git a/test cases/common/149 special characters/meson.build b/test cases/common/149 special characters/meson.build
new file mode 100644
index 0000000..ecba650
--- /dev/null
+++ b/test cases/common/149 special characters/meson.build
@@ -0,0 +1,37 @@
+project('ninja special characters' ,'c')
+
+python = import('python3').find_python()
+
+# Without newlines, this should appear directly in build.ninja.
+gen = custom_target('gen',
+ command : [
+ python,
+ files('check_quoting.py'),
+ 'dollar=$',
+ 'colon=:',
+ 'space= ',
+ '''multi1= ::$$ ::$$''',
+ '@OUTPUT@'],
+ output : 'result',
+ install : true,
+ install_dir : get_option('datadir'))
+
+# With newlines, this should go through the exe wrapper.
+gen2 = custom_target('gen2',
+ command : [
+ python,
+ files('check_quoting.py'),
+ '''newline=
+''',
+ 'dollar=$',
+ 'colon=:',
+ 'space= ',
+ '''multi2= ::$$
+
+
+
+::$$''',
+ '@OUTPUT@'],
+ output : 'result2',
+ install : true,
+ install_dir : get_option('datadir'))