aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2022-06-19 22:16:20 +0300
committerGitHub <noreply@github.com>2022-06-19 22:16:20 +0300
commitdf4714be951bc8f7545cb5e78181274033dd86e4 (patch)
treeabe8e1c809aa052d8efb1dfd20ea58ebe297505d /test cases
parent22dcb692adefea7d51e480e36a53446cc0777c01 (diff)
parente9576a43611d751a8405525cf32ee0109787d161 (diff)
downloadmeson-df4714be951bc8f7545cb5e78181274033dd86e4.zip
meson-df4714be951bc8f7545cb5e78181274033dd86e4.tar.gz
meson-df4714be951bc8f7545cb5e78181274033dd86e4.tar.bz2
Merge pull request #10464 from rtbo/fix_generated_deps
add D generated files to order-only deps
Diffstat (limited to 'test cases')
-rw-r--r--test cases/d/16 code generation/exe.d9
-rw-r--r--test cases/d/16 code generation/generator.d13
-rw-r--r--test cases/d/16 code generation/input.txt1
-rw-r--r--test cases/d/16 code generation/meson.build18
4 files changed, 41 insertions, 0 deletions
diff --git a/test cases/d/16 code generation/exe.d b/test cases/d/16 code generation/exe.d
new file mode 100644
index 0000000..0e24d6d
--- /dev/null
+++ b/test cases/d/16 code generation/exe.d
@@ -0,0 +1,9 @@
+module exe;
+
+import generated;
+import std.stdio;
+
+int main()
+{
+ return generatedString() == "Some text to be returned by generated code" ? 0 : 1;
+}
diff --git a/test cases/d/16 code generation/generator.d b/test cases/d/16 code generation/generator.d
new file mode 100644
index 0000000..f944dd3
--- /dev/null
+++ b/test cases/d/16 code generation/generator.d
@@ -0,0 +1,13 @@
+module generator;
+
+import std.file;
+import std.stdio;
+import std.string;
+
+void main(string[] args)
+{
+ const text = cast(string)read(args[1]);
+
+ writeln("module generated;");
+ writefln!`string generatedString() { return "%s"; }`(text.strip());
+}
diff --git a/test cases/d/16 code generation/input.txt b/test cases/d/16 code generation/input.txt
new file mode 100644
index 0000000..aebcda8
--- /dev/null
+++ b/test cases/d/16 code generation/input.txt
@@ -0,0 +1 @@
+Some text to be returned by generated code
diff --git a/test cases/d/16 code generation/meson.build b/test cases/d/16 code generation/meson.build
new file mode 100644
index 0000000..2418aca
--- /dev/null
+++ b/test cases/d/16 code generation/meson.build
@@ -0,0 +1,18 @@
+project('meson-dep-test', 'd')
+
+generator = executable('generator', 'generator.d')
+
+generated = custom_target('generated',
+ capture: true,
+ output: 'generated.d',
+ input: 'input.txt',
+ command: [
+ generator, '@INPUT@'
+ ]
+)
+
+exe = executable('exe', generated, 'exe.d',
+ include_directories: include_directories('.'),
+)
+
+test('test exe', exe)