1 module tests.it.dub; 2 3 import unit_threaded; 4 5 @("describe") 6 @Tags(["dub"]) 7 unittest { 8 9 import std.string: join; 10 import std.algorithm: find; 11 import std.format: format; 12 import std.process; 13 import std.array: replace; 14 15 const string[string] env = null; 16 Config config = Config.none; 17 size_t maxOutput = size_t.max; 18 19 with(immutable Sandbox()) { 20 writeFile("dub.sdl", 21 [ 22 `name "foo"`, 23 `targetType "executable"`, 24 `dependency "bar" path="bar"`, 25 `versions "lefoo"` 26 ].join("\n")); 27 28 writeFile("source/app.d", 29 [ 30 `void main() {`, 31 ` import bar;`, 32 ` lebar;`, 33 `}`, 34 ]); 35 36 writeFile("bar/dub.sdl", 37 [ 38 `name "bar"`, 39 `targetType "library"`, 40 ].join("\n")); 41 42 43 writeFile("bar/source/bar.d", 44 [ 45 `module bar;`, 46 `void lebar() {}`, 47 ]); 48 49 const ret = execute(["dub", "describe"], env, config, maxOutput, testPath); 50 if(ret.status != 0) 51 throw new Exception("Could not call dub describe:\n" ~ ret.output); 52 53 ret.output.find("{").replace("/", `\/`).shouldBeSameJsonAs( 54 import("foobar.json").format(testPath, testPath, testPath, testPath, testPath, 55 testPath, testPath, testPath, testPath, testPath, testPath)); 56 } 57 }