Skip to content

Commit

Permalink
Add tests for broken git dependency failures
Browse files Browse the repository at this point in the history
  • Loading branch information
tobil4sk committed Aug 7, 2022
1 parent f28a4c8 commit 39e395d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/libraries/libBrokenDep/haxelib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "Foo",
"url" : "http://example.org",
"license": "GPL",
"tags": ["foo", "test"],
"description": "This project has a git dependency with a non-existent url",
"version": "1.0.0",
"dependencies": {
"Bar": "git:./libraries/broken-git-dep"
},
"contributors": ["Foo"]
}
2 changes: 2 additions & 0 deletions test/tests/integration/TestGit.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ class TestGit extends TestVcs {

makeGitRepo(vcsLibPath);
makeGitRepo(vcsLibNoHaxelibJson);
makeGitRepo(vcsBrokenDependency);
}

override function tearDown() {
resetGitRepo(vcsLibPath);
resetGitRepo(vcsLibNoHaxelibJson);
resetGitRepo(vcsBrokenDependency);

super.tearDown();
}
Expand Down
2 changes: 2 additions & 0 deletions test/tests/integration/TestHg.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ class TestHg extends TestVcs {

makeHgRepo(vcsLibPath);
makeHgRepo(vcsLibNoHaxelibJson);
makeHgRepo(vcsBrokenDependency);
}

override function tearDown() {
resetHgRepo(vcsLibPath);
resetHgRepo(vcsLibNoHaxelibJson);
resetHgRepo(vcsBrokenDependency);

super.tearDown();
}
Expand Down
8 changes: 8 additions & 0 deletions test/tests/integration/TestInstall.hx
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,12 @@ class TestInstall extends IntegrationTests {
assertTrue(r.out.indexOf("[hg]") >= 0);
assertSuccess(r);
}

function testLocalWithBrokenDependency() {

final r = haxelib(["install", "libraries/libBrokenDep.zip"]).result();
assertFail(r);
assertOutputEquals(["Error: Failed installing dependencies for Foo:", "Could not clone Git repository."], r.err.trim());

}
}
13 changes: 13 additions & 0 deletions test/tests/integration/TestVcs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ abstract class TestVcs extends IntegrationTests {

final vcsLibPath = "libraries/libBar";
final vcsLibNoHaxelibJson = "libraries/libNoHaxelibJson";
final vcsBrokenDependency = "libraries/libBrokenDep";

function new(cmd:String) {
super();
Expand Down Expand Up @@ -122,4 +123,16 @@ abstract class TestVcs extends IntegrationTests {
assertSuccess(r);
assertTrue(r.out.indexOf("lib//") < 0);
}

function testBrokenDependency() {

final r = haxelib([cmd, "Foo", vcsBrokenDependency]).result();
assertFail(r);
assertOutputEquals([
"Error: Failed installing dependencies for Foo:",
"Could not clone Git repository."
], r.err.trim());

}

}

0 comments on commit 39e395d

Please sign in to comment.