1 module tests.it.buildgen.multiple_outputs;
2 
3 
4 version(DigitalMars):
5 
6 
7 import tests.it.buildgen;
8 import reggae.path: buildPath;
9 
10 enum project = "multiple_outputs";
11 
12 
13 private void doBuild(string module_)(in string reggaefileName, ref Options options) {
14     import tests.utils;
15     import std.file: remove, rename;
16 
17     prepareTestBuild!module_(options);
18 
19     const testPath = options.workingDir;
20     remove(buildPath(testPath, "protocol.d"));
21     rename(buildPath(testPath, reggaefileName), buildPath(testPath, "reggaefile.d"));
22     ["dmd", buildPath(testPath, "compiler.d")].shouldExecuteOk(WorkDir(testPath));
23     ["dmd", buildPath(testPath, "translator.d")].shouldExecuteOk(WorkDir(testPath));
24 
25     justDoTestBuild!module_(options);
26 }
27 
28 
29 static foreach (backend; ["ninja", "make", "binary"])
30     @("separate (" ~ backend ~ ")")
31     @Tags(backend, "travis_oops")
32     unittest {
33         auto options = testProjectOptions(backend, project);
34 
35         enum module_ = "multiple_outputs.reggaefile_sep";
36         doBuild!module_("reggaefile_sep.d", options);
37 
38         ["app", "2"].shouldSucceed.shouldEqual(["I call protoFunc(2) and get 4"]);
39 
40         overwrite(options, "protocol.proto", "int protoFunc(int n) { return n * 3; }");
41         buildCmdShouldRunOk!module_(options);
42 
43         ["app", "3"].shouldSucceed.shouldEqual(["I call protoFunc(3) and get 9"]);
44     }
45 
46 
47 static foreach (backend; ["ninja", "make", "binary"])
48     @("together (" ~ backend ~ ")")
49     @Tags(backend, "travis_oops")
50     unittest {
51         auto options = testProjectOptions(backend, project);
52 
53         enum module_ = "multiple_outputs.reggaefile_tog";
54         doBuild!module_("reggaefile_tog.d", options);
55 
56         ["app", "2"].shouldSucceed.shouldEqual(["I call protoFunc(2) and get 4"]);
57 
58         overwrite(options, "protocol.proto", "int protoFunc(int n) { return n * 3; }");
59         buildCmdShouldRunOk!module_(options);
60 
61         ["app", "3"].shouldSucceed.shouldEqual(["I call protoFunc(3) and get 9"]);
62     }