-
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.
feat(sdk): adding std.Map tests (#4336)
This is the first time I am writing tests, so admittedly my tests are not that versatile. But as I also believe that std tests should be straightforward, I do not totally mind it. Since `keys()` and `values()` methods of maps seems to return an array that fails to assert "is the same as another array of same elements" (which seems to be a [bug](#4118)), I had to iterate over the array values and confirm it works as expected. closes: #4363 ## Checklist - [ ] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [ ] Description explains motivation and solution - [ ] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *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
926c3d4
commit 41fabd5
Showing
6 changed files
with
1,015 additions
and
3 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
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,4 +1,12 @@ | ||
let m1 = Map<str>{"a" => "hi"}; | ||
|
||
m1.set("a", "bye"); | ||
// ^^^ Unknown symbol "set" (TODO: better error message https://github.com/winglang/wing/issues/1660) | ||
// ^^^ Unknown symbol "set" (TODO: better error message https://github.com/winglang/wing/issues/1660) | ||
|
||
let m2: Map<str> = MutMap<str> {}; | ||
let m3 = Map<bool> { "a" => "A" }; | ||
let m4 = {"1" => 1, "2" => 2 }; | ||
m4.set("2", 3); | ||
let m5 = m4.copy(); | ||
m4.delete("1"); | ||
m4.clear(); |
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
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
Oops, something went wrong.