-
Notifications
You must be signed in to change notification settings - Fork 0
/
library_test.d
49 lines (39 loc) · 998 Bytes
/
library_test.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import std.algorithm : filter;
import std.array : array;
import std.stdio;
import std.process : spawnProcess, Config, wait;
@safe:
void main()
{
executeCommand(dubShellCommand());
}
string[] dubShellCommand() pure nothrow
{
return (["dub", "run", "--verror"] ~ dubArch)
.filter!(e => e.length > 0)
.array;
}
void executeCommand(const string[] args ...)
{
import std.process : spawnProcess, wait;
import std.array : join;
immutable string[string] env;
immutable config = Config.none;
immutable workDir = "tests/functional/test_package";
if (spawnProcess(args, env, config, workDir).wait() != 0)
throw new Exception("Failed to execute command: " ~ args.join(' '));
}
string dubArch() pure nothrow
{
version (Win64)
return "--arch=x86_64";
else version (Win32)
{
version (DigitalMars)
return "--arch=x86_mscoff";
else
return "--arch=x86";
}
else
return "";
}