2
0
Simon Krajewski 6 жил өмнө
parent
commit
c67ed00034

+ 12 - 7
tests/asys/test/TestAsyncFileSystem.hx

@@ -1,5 +1,6 @@
 package test;
 
+import utest.Assert;
 import asys.FileWatcherEvent;
 import utest.Async;
 import asys.FileSystem as NewFS;
@@ -74,18 +75,22 @@ class TestAsyncFileSystem extends Test {
 		eq(asyncDone, 0);
 	}
 
+	@:timeout(500)
 	function testWatcher(async:Async) {
 		var dir = '$testDir/watch';
 		sys.FileSystem.createDirectory(dir);
-		var expectedEvents:Array<FileWatcherEvent -> Bool> = [
-			event -> event.match(Rename("foo")),
+		var expectedEvents:Array<FileWatcherEvent -> Void> = [
 			event -> switch(event) {
-				case Rename("foo/hello.txt" | "foo\\hello.txt"): true;
-				case _: false;
+				case Rename("foo"): Assert.pass();
+				case _: Assert.fail("Expected Rename(foo) but got " + event);
 			},
 			event -> switch(event) {
-				case Change("foo/hello.txt" | "foo\\hello.txt"): true;
-				case _: false;
+				case Rename("foo/hello.txt" | "foo\\hello.txt"): Assert.pass();
+				case _: Assert.fail("Expected Rename(foo/hello.txt) but got " + event);
+			},
+			event -> switch(event) {
+				case Change("foo/hello.txt" | "foo\\hello.txt"): Assert.pass();
+				case _: Assert.fail("Expected Change(foo/hello.txt) but got " + event);
 			}
 		];
 
@@ -101,7 +106,7 @@ class TestAsyncFileSystem extends Test {
 		watcher.changeSignal.on(event -> {
 			t(expectedEvents.length > 0);
 			var expected = expectedEvents.shift();
-			t(expected(event));
+			expected(event);
 			if (continuations.length > 0) {
 				continuations.shift()();
 			}

+ 5 - 1
tests/asys/test/TestIpc.hx

@@ -1,5 +1,6 @@
 package test;
 
+import utest.Assert;
 import haxe.io.Bytes;
 import utest.Async;
 
@@ -37,7 +38,10 @@ class TestIpc extends Test {
 				})
 			}, (err) -> {
 					eq(err, null);
-					t(client.remoteAddress.match(Unix('$testDir/ipc-pipe')));
+					switch (client.remoteAddress) {
+						case Unix(path): eq('$testDir/ipc-pipe', path);
+						case _: Assert.fail();
+					}
 					client.errorSignal.on(err -> assert());
 					client.write(TestConstants.helloBytes);
 					client.dataSignal.on(chunk -> {