1 /**
2 Copyright: Copyright (c) 2017, Joakim Brännström. All rights reserved.
3 License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
4 Author: Joakim Brännström (joakim.brannstrom@gmx.com)
5 
6 The only purpose of this file is to redirect the execution of integration tests
7 from the main directory to the subdirectory test.
8 
9 It is NOT intended to be used for anything else.
10 */
11 module autoformat.test.redirect;
12 
13 import std.exception;
14 import std.file;
15 import std.path;
16 import std.process;
17 import std.stdio;
18 
19 int main(string[] args) {
20     writeln("===============================");
21     writeln("Redirecting testing to: ", buildPath(getcwd, "test"));
22 
23     // make sure the build is pristine
24     if (spawnProcess(["dub", "build", "-c", "application"]).wait != 0) {
25         return -1;
26     }
27 
28     chdir("test");
29 
30     args = () {
31         if (args.length > 1)
32             return args[1 .. $];
33         return null;
34     }();
35 
36     return spawnProcess(["dub", "test", "--"] ~ args).wait;
37 }