From 66df7a91839e379606862595e6218c51fff5dd65 Mon Sep 17 00:00:00 2001 From: devdinc <234956748+devdinc@users.noreply.github.com> Date: Sat, 17 Jan 2026 20:51:13 +0300 Subject: [PATCH 1/4] Create tests for pdc.sk Ai generated --- tests/pdc.sk | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 tests/pdc.sk diff --git a/tests/pdc.sk b/tests/pdc.sk new file mode 100644 index 0000000..49f711c --- /dev/null +++ b/tests/pdc.sk @@ -0,0 +1,75 @@ +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 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 {_none} 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 {_none} 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 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 {_none} with "missing object did not return none" From 64f49c1f2ce177cb3db70252c20e59ff64d313df Mon Sep 17 00:00:00 2001 From: devdinc <234956748+devdinc@users.noreply.github.com> Date: Sat, 17 Jan 2026 21:02:16 +0300 Subject: [PATCH 2/4] Fix test issues --- tests/pdc.sk | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/pdc.sk b/tests/pdc.sk index 49f711c..9c8a747 100644 --- a/tests/pdc.sk +++ b/tests/pdc.sk @@ -1,9 +1,12 @@ +import: + java.util.HashMap + 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 42 - assert {_key} within test-world for pdt integer is 42 with "typed pdt get failed" + set {_key} within test-world for pdt integer to (42 parsed as integer) + assert {_key} within test-world for pdt long is (42 parsed as integer) with "typed pdt get failed" test "pdc overwrite typed value": @@ -23,7 +26,7 @@ test "pdc delete typed value": 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 {_none} with "delete failed" + assert {_key} within test-world for pdt long is not set with "delete failed" test "pdc object serialization (byte_array implicit)": @@ -48,7 +51,7 @@ test "pdc remove object via null": set {_key} within test-world to "temp" set {_key} within test-world to null - assert {_key} within test-world is {_none} with "object remove via null failed" + assert {_key} within test-world is not set with "object remove via null failed" test "pdc holder vs direct pdc equivalence": @@ -56,8 +59,8 @@ 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 7 - assert {_key} within {_pdc} for pdt byte is 7 with "direct pdc access failed" + set {_key} within test-world for pdt byte to (7 parsed as byte) + assert {_key} within {_pdc} for pdt byte is (7 parsed as byte) with "direct pdc access failed" test "pdc boolean pdt": @@ -72,4 +75,4 @@ test "pdc default object missing returns none": set {_key} to namespaced-key "plugin:test_missing" - assert {_key} within test-world is {_none} with "missing object did not return none" + assert {_key} within test-world is not set with "missing object did not return none" From 3871769ac1dba09b2defc7f718d5371793d4000c Mon Sep 17 00:00:00 2001 From: devdinc <234956748+devdinc@users.noreply.github.com> Date: Sat, 17 Jan 2026 21:08:29 +0300 Subject: [PATCH 3/4] Update pdc.sk --- tests/pdc.sk | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/pdc.sk b/tests/pdc.sk index 9c8a747..bbbf0be 100644 --- a/tests/pdc.sk +++ b/tests/pdc.sk @@ -1,12 +1,14 @@ 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 (42 parsed as integer) - assert {_key} within test-world for pdt long is (42 parsed as integer) with "typed pdt get failed" + 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": @@ -59,8 +61,8 @@ 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 (7 parsed as byte) - assert {_key} within {_pdc} for pdt byte is (7 parsed as byte) with "direct pdc access failed" + 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": From c535a6986f43751d29c9023592f056b16bcad0dc Mon Sep 17 00:00:00 2001 From: devdinc <234956748+devdinc@users.noreply.github.com> Date: Sat, 17 Jan 2026 21:13:06 +0300 Subject: [PATCH 4/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 93d22a1..38d5b1d 100644 --- a/README.md +++ b/README.md @@ -41,3 +41,4 @@ Skript loads files alphabetically, with folders being prioritized. To control lo Currents plans include: - multiline lambda expression - making the test framework support extending over the skriptlang native test suit +- Auto casting for primitives, pdc.sk(new Byte,Integer etc)