summaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-05-22 20:46:26 +0300
committerGitHub <noreply@github.com>2018-05-22 20:46:26 +0300
commit9ecd92c6fedd052f4115683726a5cc6ebaa33e85 (patch)
tree794a3df4990aa5397c7e284185b284bb956b6cb5 /test cases
parentf4194d4dbc5c48ff9a0d76c779876aab60754230 (diff)
parentfe6fc59ee75f44acdaac0abc757c687916d4618a (diff)
downloadmeson-9ecd92c6fedd052f4115683726a5cc6ebaa33e85.tar.gz
Merge pull request #3490 from MathieuDuponchelle/dict_builtin
Add new built-in type, dict
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/199 dict/meson.build23
-rw-r--r--test cases/common/199 dict/prog.c8
2 files changed, 31 insertions, 0 deletions
diff --git a/test cases/common/199 dict/meson.build b/test cases/common/199 dict/meson.build
new file mode 100644
index 000000000..e1ee2e33b
--- /dev/null
+++ b/test cases/common/199 dict/meson.build
@@ -0,0 +1,23 @@
+project('dict test', 'c')
+
+dict = {'foo' : 'bar',
+ 'baz' : 'foo',
+ 'foo bar': 'baz'}
+
+exe = executable('prog', sources : ['prog.c'])
+
+i = 0
+
+foreach key, value : dict
+ test('dict test @0@'.format(key), exe,
+ args : [dict[key], value])
+ i += 1
+endforeach
+
+assert(i == 3, 'There should be three elements in that dictionary')
+
+empty_dict = {}
+
+foreach key, value : empty_dict
+ assert(false, 'This dict should be empty')
+endforeach
diff --git a/test cases/common/199 dict/prog.c b/test cases/common/199 dict/prog.c
new file mode 100644
index 000000000..bf0999d4a
--- /dev/null
+++ b/test cases/common/199 dict/prog.c
@@ -0,0 +1,8 @@
+#include <string.h>
+
+int main(int argc, char **argv) {
+ if (argc != 3)
+ return 1;
+
+ return strcmp(argv[1], argv[2]);
+}