-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(sdk): update
queue.pop()
sdk test (#3875)
Updating the test with the `nil` type and `Queue.push()` variadic argument instead of for loop. *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
- Loading branch information
1 parent
c3aab87
commit 27c6046
Showing
2 changed files
with
15 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,15 @@ | ||
bring cloud; | ||
|
||
let NIL = "<<NIL>>"; | ||
|
||
let q = new cloud.Queue(); | ||
|
||
test "pop" { | ||
let msgs = ["Foo", "Bar"]; | ||
for msg in msgs { | ||
q.push(msg); | ||
} | ||
q.push("Foo", "Bar"); | ||
|
||
let first = q.pop() ?? NIL; | ||
let second = q.pop() ?? NIL; | ||
let third = q.pop() ?? NIL; | ||
let first = q.pop(); | ||
let second = q.pop(); | ||
let third = q.pop(); | ||
|
||
assert(msgs.contains(first)); | ||
assert(msgs.contains(second)); | ||
assert(third == NIL); | ||
assert(first == "Foo"); | ||
assert(second == "Bar"); | ||
assert(third == nil); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters