Skip to content

Commit

Permalink
test composite queries too
Browse files Browse the repository at this point in the history
also accept good output
  • Loading branch information
ggreif committed Dec 4, 2024
1 parent f7b72a1 commit 3056a13
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions test/run-drun/composite-query.mo
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ actor Composites {
};

public composite query func cq1() : async () {
assert 0 : Nat64 == Prim.replyDeadline();
};

public composite query func cq2() : async () {
Expand Down
4 changes: 2 additions & 2 deletions test/run-drun/ok/composite-query.tc.ok
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
composite-query.mo:30.11-30.13: warning [M0145], this pattern of type
composite-query.mo:31.11-31.13: warning [M0145], this pattern of type
?Class__1
does not cover value
null
composite-query.mo:35.11-35.13: warning [M0145], this pattern of type
composite-query.mo:36.11-36.13: warning [M0145], this pattern of type
?Class__1
does not cover value
null
10 changes: 9 additions & 1 deletion test/run-drun/ok/query2.drun-run.ok
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@ ingress Completed: Reply: 0x4449444c0000
debug.print: 2
debug.print: 3
debug.print: 4
ingress Completed: Reject: IC0504: Error from Canister rwlgt-iiaaa-aaaaa-aaaaa-cai: Canister violated contract: ic0::msg_deadline is not enabled.
debug.print: 4
debug.print: In read:
debug.print: 5
debug.print: 4
debug.print: In read:
debug.print: 5
debug.print: 4
debug.print: The following fails in the interpreter, for lack of query semantics
ingress Completed: Reply: 0x4449444c0000
4 changes: 2 additions & 2 deletions test/run-drun/query2.mo
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ actor counter = {
Prim.debugPrintNat c;
};
public func printCounter () : async () {
assert Prim.replyDeadline() == (0 : Nat64);
assert 0 : Nat64 == Prim.replyDeadline();
Prim.debugPrintNat c;
};
public func get() : async Nat {
return c
};
public query func read() : async Nat {
assert Prim.replyDeadline() == (0 : Nat64);
assert 0 : Nat64 == Prim.replyDeadline();
let tmp = c;
c += 1;
Prim.debugPrint "In read:";
Expand Down

0 comments on commit 3056a13

Please sign in to comment.