-
Notifications
You must be signed in to change notification settings - Fork 0
Create tests for pdc.sk #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| import: | ||
| java.util.HashMap | ||
| java.lang.Integer | ||
| java.lang.Byte | ||
|
|
||
| test "pdc basic set/get with typed pdt": | ||
|
|
||
| set {_key} to namespaced-key "plugin:test_int" | ||
|
|
||
| set {_key} within test-world for pdt integer to new Integer(42) | ||
| assert {_key} within test-world for pdt integer is 42 with "typed pdt get failed" | ||
|
|
||
|
|
||
| test "pdc overwrite typed value": | ||
|
|
||
| set {_key} to namespaced-key "plugin:test_overwrite" | ||
|
|
||
| set {_key} within test-world for pdt string to "a" | ||
| set {_key} within test-world for pdt string to "b" | ||
|
|
||
| assert {_key} within test-world for pdt string is "b" with "overwrite failed" | ||
|
|
||
|
|
||
| test "pdc delete typed value": | ||
|
|
||
| set {_key} to namespaced-key "plugin:test_delete" | ||
|
|
||
| set {_key} within test-world for pdt long to 100 | ||
| delete {_key} within test-world for pdt long | ||
|
|
||
| assert {_key} within test-world for pdt long is not set with "delete failed" | ||
|
|
||
|
|
||
| test "pdc object serialization (byte_array implicit)": | ||
|
|
||
| set {_key} to namespaced-key "plugin:test_object" | ||
|
|
||
| set {_obj} to new HashMap() | ||
| {_obj}.put("a", 1) | ||
| {_obj}.put("b", 2) | ||
|
|
||
| set {_key} within test-world to {_obj} | ||
|
|
||
| set {_out} to {_key} within test-world | ||
| assert {_out}.get("a") is 1 with "object deserialize failed (a)" | ||
| assert {_out}.get("b") is 2 with "object deserialize failed (b)" | ||
|
|
||
|
|
||
| test "pdc remove object via null": | ||
|
|
||
| set {_key} to namespaced-key "plugin:test_object_remove" | ||
|
|
||
| set {_key} within test-world to "temp" | ||
| set {_key} within test-world to null | ||
|
|
||
| assert {_key} within test-world is not set with "object remove via null failed" | ||
|
|
||
|
|
||
| test "pdc holder vs direct pdc equivalence": | ||
|
|
||
| set {_key} to namespaced-key "plugin:test_holder" | ||
| set {_pdc} to test-world's pdc | ||
|
|
||
| set {_key} within test-world for pdt byte to new Byte(7) | ||
| assert {_key} within {_pdc} for pdt byte is 7 with "direct pdc access failed" | ||
|
|
||
|
|
||
| test "pdc boolean pdt": | ||
|
|
||
| set {_key} to namespaced-key "plugin:test_bool" | ||
|
|
||
| set {_key} within test-world for pdt boolean to true | ||
| assert {_key} within test-world for pdt boolean is true with "boolean pdt failed" | ||
|
|
||
|
|
||
| test "pdc default object missing returns none": | ||
|
|
||
| set {_key} to namespaced-key "plugin:test_missing" | ||
|
|
||
| assert {_key} within test-world is not set with "missing object did not return none" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Polish the TODO bullet punctuation.
“etc.” needs a period, and adding a space after the comma improves readability.
Proposed edit
📝 Committable suggestion
🧰 Tools
🪛 LanguageTool
[grammar] ~43-~43: Ensure spelling is correct
Context: ...tending over the skriptlang native test suit - Auto casting for primitives, pdc.sk(new ...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[style] ~44-~44: In American English, abbreviations like “etc.” require a period.
Context: ...for primitives, pdc.sk(new Byte,Integer etc)
(ETC_PERIOD)