| 1 |
package tests; |
| 2 |
|
| 3 |
import sys.FileSystem; |
| 4 |
import sys.io.*; |
| 5 |
import haxe.io.Path; |
| 6 |
import haxe.unit.TestCase; |
| 7 |
|
| 8 |
class TestRemoveSymlinks extends TestBase |
| 9 |
{ |
| 10 |
//----------- properties, fields ------------// |
| 11 |
|
| 12 |
static var REPO = "haxelib-repo"; |
| 13 |
var lib:String = "symlinks"; |
| 14 |
var repo:String = null; |
| 15 |
var origRepo:String; |
| 16 |
|
| 17 |
//--------------- constructor ---------------// |
| 18 |
public function new() |
| 19 |
{ |
| 20 |
super(); |
| 21 |
this.repo = Path.join([Sys.getCwd(), "test", REPO]); |
| 22 |
} |
| 23 |
|
| 24 |
//--------------- initialize ----------------// |
| 25 |
|
| 26 |
override public function setup():Void |
| 27 |
{ |
| 28 |
origRepo = ~/\r?\n/.split(runHaxelib(["config"]).stdout)[0]; |
| 29 |
origRepo = Path.normalize(origRepo); |
| 30 |
|
| 31 |
var libzip = Path.join([Sys.getCwd(), "test", "libraries", lib + ".zip"]); |
| 32 |
if (runHaxelib(["setup", repo]).exitCode != 0) { |
| 33 |
throw "haxelib setup failed"; |
| 34 |
} |
| 35 |
if (runHaxelib(["local", libzip]).exitCode != 0) { |
| 36 |
throw "haxelib local failed"; |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
override public function tearDown():Void { |
| 41 |
if (runHaxelib(["setup", origRepo]).exitCode != 0) { |
| 42 |
throw "haxelib setup failed"; |
| 43 |
} |
| 44 |
deleteDirectory(repo); |
| 45 |
} |
| 46 |
|
| 47 |
//----------------- tests -------------------// |
| 48 |
|
| 49 |
public function testRemoveLibWithSymlinks():Void |
| 50 |
{ |
| 51 |
var code = runHaxelib(["remove", lib]).exitCode; |
| 52 |
assertEquals(code, 0); |
| 53 |
assertFalse(FileSystem.exists(Path.join([repo, lib]))); |
| 54 |
} |
| 55 |
} |