dyaml/unittest.d

62 lines
1.4 KiB
D
Raw Normal View History

#!/usr/bin/rdmd
2011-08-16 12:53:13 +00:00
// Copyright Ferdinand Majerech 2011.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
version(unittest)
{
import dyaml.all;
2011-08-16 12:53:13 +00:00
import dyaml.testcompare;
import dyaml.testconstructor;
import dyaml.testemitter;
import dyaml.testerrors;
import dyaml.testinputoutput;
import dyaml.testreader;
import dyaml.testrepresenter;
import dyaml.testresolver;
import dyaml.testtokens;
}
2011-08-16 12:53:13 +00:00
void main(string[] args)
2011-08-16 12:53:13 +00:00
{
import std.stdio;
version(unittest)
{
writeln("Done");
}
else
{
writeln("This is not a unittest build. Trying to build one.");
void build(string type)
{
import std.process;
const processArgs = ["dub", "build", "-c=unittest", "-b=" ~ type ~ "-unittest"];
if(spawnProcess(processArgs).wait() != 0)
{
writeln("Build failed!");
}
}
import std.algorithm;
import std.array;
args.popFront();
if(args.empty)
{
build("debug");
}
else if(["debug", "release", "profile"].canFind(args[0]))
{
build(args[0]);
}
else
{
writeln("Unknown unittest build type: ", args[0]);
}
}
2011-08-16 12:53:13 +00:00
}