diff --git a/.github/workflows/test-skripts.yml b/.github/workflows/test-skripts.yml index aaf0a0a..ee8e326 100644 --- a/.github/workflows/test-skripts.yml +++ b/.github/workflows/test-skripts.yml @@ -78,17 +78,22 @@ jobs: set {_tests::*} to all tests autorun {_tests::*} + + devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 parse section": + parse: + abc + assert last parse logs contains "Can't understand this condition/effect: abc" EOF - name: Run tests - uses: devdinc/skript-test-action@v1.3 + uses: SkriptLang/skript-test-action@v1.3 with: skript_repo_url: https://github.com/SkriptLang/Skript.git # directory where your test scripts are located (relative to repo root) test_script_directory: tests # Skript version or ref (tag, branch, or commit) - skript_repo_ref: 2.15.0-pre1 + skript_repo_ref: 2.15.0 # directory containing addon/plugin jars (relative to repo root) extra_plugins_directory: build/libs diff --git a/scripts/libs/functionsv2.sk b/scripts/libs/functionsv2.sk index 5551d1e..c3136cf 100644 --- a/scripts/libs/functionsv2.sk +++ b/scripts/libs/functionsv2.sk @@ -150,7 +150,8 @@ condition set %object% to [new] lambda[ %-objects%](1:|2:-|3:+): loop {_functionsv2.sk::ctx::nodes::*}: set {_functionsv2.sk::ctx::indent} to loop-value.[Node]getIndentation().substring(length of {_functionsv2.sk::ctx::originindent} + 4) if {_functionsv2.sk::ctx::originindent} starts with " " else loop-value.[Node]getIndentation().substring(length of {_functionsv2.sk::ctx::originindent} + 1) set {_functionsv2.sk::ctx::key} to "%{_functionsv2.sk::ctx::indent}%%loop-value.getKey()%" - set {_functionsv2.sk::ctx::key} to "%{_functionsv2.sk::ctx::key}%:" if loop-value is instance of SectionNode + if loop-value is instance of SectionNode: + set {_functionsv2.sk::ctx::key} to "%{_functionsv2.sk::ctx::key}%:" add {_functionsv2.sk::ctx::key} to {_functionsv2.sk::ctx::expr::*} {_functionsv2.sk::ctx::key}.trim() starts with "return" set {_functionsv2.sk::ctx::noreturn} to false if parse mark is 1 @@ -176,7 +177,8 @@ condition set %object% to [new] (1:supplier|1:getter|2:runnable|2:runner|3:consu loop {_functionsv2.sk::ctx::nodes::*}: set {_functionsv2.sk::ctx::indent} to loop-value.[Node]getIndentation().substring(length of {_functionsv2.sk::ctx::originindent} + 4) if {_functionsv2.sk::ctx::originindent} starts with " " else loop-value.[Node]getIndentation().substring(length of {_functionsv2.sk::ctx::originindent} + 1) set {_functionsv2.sk::ctx::key} to "%{_functionsv2.sk::ctx::indent}%%loop-value.getKey()%" - set {_functionsv2.sk::ctx::key} to "%{_functionsv2.sk::ctx::key}%:" if loop-value is instance of SectionNode + if loop-value is instance of SectionNode: + set {_functionsv2.sk::ctx::key} to "%{_functionsv2.sk::ctx::key}%:" add {_functionsv2.sk::ctx::key} to {_functionsv2.sk::ctx::expr::*} set {_functionsv2.sk::ctx::args::*} to FextractArgs({_functionsv2.sk::ctx::vars}) diff --git a/scripts/utils/testframework.sk b/scripts/utils/testframework.sk index 8006d69..c44b58b 100644 --- a/scripts/utils/testframework.sk +++ b/scripts/utils/testframework.sk @@ -210,7 +210,7 @@ effect: then: if parse tags does not contain "5": sendTestFailMessage "Test ""%{_test}%"" with condition '%{_label}%: %{_raw}%' failed", expr-1 - TestTracker.testFailed(expr-1) + TestTracker.testFailed("Test ""%{_test}%"" with condition '%{_label}%: %{_raw}%' failed", {_script}) add "%expr-1%" to {-test.sk::errors::%{_script}%.%{_test}%::*} if parse tags contains "3": delay effect @@ -223,7 +223,7 @@ effect (3:|4:(no|without) (halt[ing]|fail[(-| )](safe|fast)|abort[ing])) fail te set {_script} to event.getEventValue("script") if parse tags does not contain "5": sendTestFailMessage "Test ""%{_test}%"" failed", expr-1 - TestTracker.testFailed(expr-1) + TestTracker.testFailed("Test ""%{_test}%"" with condition '%{_label}%: %{_raw}%' failed", {_script}) add "%expr-1%" to {-test.sk::errors::%{_script}%.%{_test}%::*} if parse tags contains "3": delay effect @@ -277,7 +277,7 @@ condition parse: {_logger}.close() {_parser}.reset() -plural expression last parse logs: +plural expression (last|latest) parse logs: usable in: custom event "skriptTest" get: diff --git a/tests/working/utils/testframework.test.sk b/tests/working/utils/testframework.test.sk index 84dc0ec..6dd744a 100644 --- a/tests/working/utils/testframework.test.sk +++ b/tests/working/utils/testframework.test.sk @@ -1,7 +1,3 @@ -local effect no errors\: <.+>: - trigger: - stop - devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 assert true passes": assert true: {_none} is not set @@ -13,7 +9,6 @@ devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 framework internal consistenc without halting assert true: "%current script%" is set assert true: size of test errors is 0 - devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 assert true failure is recorded": without halting assert true with no error message: {_none} is set assert true: size of test errors is 1 @@ -90,11 +85,6 @@ devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 test-block is temporary A": devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 test-block is temporary B": assert true: {-test.sk::temptestblocka} is test-block's type assert true: {-test.sk::temptestblocka} is not {-test.sk::temptestblockb} - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 parse section": - parse: - no errors: abc # just an internal stuff to make sure test.sk loads without errors - assert last parse logs contains "Can't understand this condition/effect: no errors: abc" devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 last test result A": fail test with no error message