Skip to content

Commit 2968b35

Browse files
committed
Assert on fail > 0.
1 parent 59d475a commit 2968b35

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Status.mo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ module {
1313
public func printStatus() {
1414
let total = debug_show(_pass + _fail);
1515
debugPrint("🟢 " # debug_show(_pass) # "/" # total # " | 🛑 " # debug_show(_fail) # "/" # total # "\n");
16+
switch (_fail) {
17+
case (0) {};
18+
case (_) assert(false);
19+
};
1620
};
1721
};
1822
};

src/SuiteState.mo

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,18 @@ module {
3939
#Test(name, func (state : T, print : (t : Text) -> ()) : Bool = test(state));
4040
};
4141

42+
public func its<T>(name : Text, test : (state : T) -> async* Bool) : NamedTest<T> {
43+
#TestAsync(name, func (state : T, print : (t : Text) -> ()) : async* Bool { await* test(state) });
44+
};
45+
4246
public func itp<T>(name : Text, test : Test<T>) : NamedTest<T> {
4347
#Test(name, test);
4448
};
4549

50+
public func itsp<T>(name : Text, test : TestAsync<T>) : NamedTest<T> {
51+
#TestAsync(name, test);
52+
};
53+
4654
private func doNothing<T>() : Testing<T> { func (_ : T) {} };
4755

4856
public class Suite<T>(state : T) {

0 commit comments

Comments
 (0)