aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemi Thebault <remi.thebault@gmail.com>2022-03-05 16:16:20 +0100
committerDylan Baker <dylan@pnwbakers.com>2022-03-23 10:21:21 -0700
commitcc880d3ad59aae0269e3e6213e6ee56844d2d739 (patch)
tree7627fcb698faceece33eaf78a70b7534f53aa593
parent04fca24355c237bd969a4ddee7b494c60804a3a7 (diff)
downloadmeson-cc880d3ad59aae0269e3e6213e6ee56844d2d739.zip
meson-cc880d3ad59aae0269e3e6213e6ee56844d2d739.tar.gz
meson-cc880d3ad59aae0269e3e6213e6ee56844d2d739.tar.bz2
add test d/14 dub with deps
-rw-r--r--test cases/d/14 dub with deps/meson.build34
-rw-r--r--test cases/d/14 dub with deps/test.d59
2 files changed, 93 insertions, 0 deletions
diff --git a/test cases/d/14 dub with deps/meson.build b/test cases/d/14 dub with deps/meson.build
new file mode 100644
index 0000000..e0bd847
--- /dev/null
+++ b/test cases/d/14 dub with deps/meson.build
@@ -0,0 +1,34 @@
+project('dub-with-deps-example', ['c', 'd'])
+
+dub_exe = find_program('dub', required : false)
+if not dub_exe.found()
+ error('MESON_SKIP_TEST: Dub not found')
+endif
+
+if meson.get_compiler('d').get_id() == 'gcc'
+ error('MESON_SKIP_TEST: can\'t build dependencies with GDC')
+elif meson.get_compiler('d').get_id() == 'llvm'
+ dc = 'ldc2'
+elif meson.get_compiler('d').get_id() == 'dmd'
+ dc = 'dmd'
+endif
+
+arch = host_machine.cpu_family()
+
+if host_machine.system() == 'windows'
+ # check if toolchain is 32bits
+ sz = meson.get_compiler('c').sizeof('void*')
+ if arch == 'x86' or sz == 4
+ arch = 'x86_mscoff'
+ endif
+endif
+
+run_command('dub', 'run', 'dub-build-deep', '--yes', '--', 'xlsx', '--compiler', dc, '--arch', arch,
+ check: true,
+)
+
+xlsx_dep = dependency('xlsx', method: 'dub')
+
+test_exe = executable('test-test6', 'test.d', dependencies: xlsx_dep)
+
+test('test dub with deps', test_exe)
diff --git a/test cases/d/14 dub with deps/test.d b/test cases/d/14 dub with deps/test.d
new file mode 100644
index 0000000..61b5bda
--- /dev/null
+++ b/test cases/d/14 dub with deps/test.d
@@ -0,0 +1,59 @@
+module test;
+
+// testing import dirs
+import xlsx;
+
+// dependency of xlsx
+import dxml.dom;
+
+const xml = "<!-- comment -->\n" ~
+ "<root>\n" ~
+ " <foo>some text<whatever/></foo>\n" ~
+ " <bar/>\n" ~
+ " <baz></baz>\n" ~
+ "</root>";
+
+int main()
+{
+ // testing versions
+ version (Have_dxml)
+ {
+ import std.range.primitives : empty;
+
+ auto dom = parseDOM(xml);
+ assert(dom.type == EntityType.elementStart);
+ assert(dom.name.empty);
+ assert(dom.children.length == 2);
+
+ assert(dom.children[0].type == EntityType.comment);
+ assert(dom.children[0].text == " comment ");
+
+ auto root = dom.children[1];
+ assert(root.type == EntityType.elementStart);
+ assert(root.name == "root");
+ assert(root.children.length == 3);
+
+ auto foo = root.children[0];
+ assert(foo.type == EntityType.elementStart);
+ assert(foo.name == "foo");
+ assert(foo.children.length == 2);
+
+ assert(foo.children[0].type == EntityType.text);
+ assert(foo.children[0].text == "some text");
+
+ assert(foo.children[1].type == EntityType.elementEmpty);
+ assert(foo.children[1].name == "whatever");
+
+ assert(root.children[1].type == EntityType.elementEmpty);
+ assert(root.children[1].name == "bar");
+
+ assert(root.children[2].type == EntityType.elementStart);
+ assert(root.children[2].name == "baz");
+ assert(root.children[2].children.length == 0);
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+}