Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
katsaii committed Aug 11, 2024
1 parent 80e8d61 commit 51234b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ test_add(function() : Test("with-struct") constructor {
var result = _func();
assertTypeof(result, "struct");
assertEq(1, result.a);
});
}, IgnorePlatform.WIN_YYC);

test_add(function() : Test("with-noone") constructor {
var engine = new CatspeakEnvironment();
Expand Down Expand Up @@ -664,8 +664,13 @@ test_add(function() : Test("with-inst") constructor {
var inst1Self, inst2Self;
with (inst1) { inst1Self = self }
with (inst2) { inst2Self = self }
assertEq(inst1Self, result.arr[0]);
assertEq(inst2Self, result.arr[1]);
assert(instance_exists(result.arr[0]));
assert(instance_exists(result.arr[1]));
for (var i = 0; i < array_length(result.arr); i += 1) {
// order may be inconsistent
var catspeakSelf = result.arr[i];
assert(inst1Self == catspeakSelf || inst2Self == catspeakSelf);
}
instance_destroy(inst1);
instance_destroy(inst2);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,19 @@ function Test(name) constructor {
return testCase;
};

self.currentTestCase = 0;
__makeTestCaseStruct = function () {
currentTestCase += 1;
return {
testCaseIdx : currentTestCase,
idx : -1,
fails : fails,
failed : false,
fail : function (msg="no message") {
failed = true;
if (idx < 0) {
idx = array_length(fails);
fails[@ idx] = __cat(msg);
fails[@ idx] = __cat("#", testCaseIdx, " ", msg);
} else {
fails[@ idx] = __cat(fails[idx], " + ", msg);
}
Expand Down

0 comments on commit 51234b1

Please sign in to comment.