diff --git a/.github/workflows/order-scripts.yml b/.github/workflows/order-scripts.yml deleted file mode 100644 index 5039028..0000000 --- a/.github/workflows/order-scripts.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Order Scripts - -on: - push: - branches: - - ordered - -permissions: - contents: write - -jobs: - restructure: - runs-on: ubuntu-latest - steps: - - uses: devdinc/restructure-action@v0.1.1 - with: - source-ref: stable - restructure-file: .restructure diff --git a/.restructure b/.restructure deleted file mode 100644 index e518a3b..0000000 --- a/.restructure +++ /dev/null @@ -1,7 +0,0 @@ -using scripts - -prefix: - 0 libs/parser/singlelinesection.sk - 1 libs/functionsv2.sk - 2 libs/routines.sk - 3 . diff --git a/scripts/utils/testframework.sk b/scripts/utils/testframework.sk index 14d121a..8006d69 100644 --- a/scripts/utils/testframework.sk +++ b/scripts/utils/testframework.sk @@ -276,10 +276,6 @@ condition parse: set {-test.sk::latestLogs::*} to {_logs::*} {_logger}.close() {_parser}.reset() - -local effect no errors\: <.+>: - trigger: - stop plural expression last parse logs: usable in: @@ -331,104 +327,3 @@ expression [the] test(-| )offline[-| ]player: set {_instance} to new TestOfflinePlayer() # TestOfflinePlayer.[TestOfflinePlayer]PLAYER_PROFILE.setProperty(new ProfileProperty("textures", "ewogICJ0aW1lc3RhbXAiIDogMTc0NzQyOTg2MTQwOCwKICAicHJvZmlsZUlkIiA6ICI2OWUzNzAyNjJjN2Q0MjU1YWM3NjliMTNhNWZlOGY3NCIsCiAgInByb2ZpbGVOYW1lIiA6ICJTYWh2ZGUiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTE2MGFiZWVhNDI1YzZmODMyYjc0NmE0NTQ0YzVmYjlhOTgxYjAyZTFiZDg1ZmVhNWM3ZWY4MzFiZGM4NzRmMyIKICAgIH0KICB9Cn0=")); return {_instance} - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 assert true passes": - assert true: {_none} is not set - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 assert false passes": - assert false: {_none} is set - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 framework internal consistency": - without halting assert true: size of all tests > 0 - 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 - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 assert error message is stored": - without halting assert true with no error message "msg1": {_none} is set - assert true with message "check failed": test errors contains "msg1" - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 no error message produces empty suffix": - without halting assert true with no error message: {_none} is set - assert true: size of test errors is 1 - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 halting assert stops execution": - assert true with no error message: {_none} is set - broadcast "ERROR: this should never execute" - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 without halting continues execution": - without halting assert true with no error message: {_none} is set - assert true: {_none} is not set - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 fail test records error": - without halting fail test with no error message - assert true: size of test errors is 1 - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 fail test halts by default": - fail test with no error message - broadcast "ERROR: fail test did not halt" - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 autorun flag is true": - if event-test is not autorun: - stop - assert true: event-test is autorun - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 manual run flag is false" when {_none} is set: - fail test - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 manual run flag" when event-test is not autorun: - fail test if event-test is autorun - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 stop auto execution works": - if event-test is not autorun: - stop - stop auto test execution here - broadcast "ERROR: auto execution not stopped" - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 all tests returns this test": - set {_all::*} to all tests with test name "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 all tests returns this test" - assert true: size of {_all::*} > 0 - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 all tests": - set {_all::*} to all tests - assert true: size of {_all::*} > 0 - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 errors do not leak between tests A": - without halting assert true with no message: {_none} is set - assert true: size of test errors is 1 - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 errors do not leak between tests B": - assert true: size of test errors is 0 - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 event-test returns correct name": - assert true: event-test[0] is event-string - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 test-block is temporary A": - set {-test.sk::temptestblocka} to test-block's type - test block is chest: - set test-block to trapped chest - else if test block is trapped chest: - set test-block to chest - else: - set test-block to ender chest - set {-test.sk::temptestblockb} to test-block's type - -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 - -devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 last test result B": - set {_test::*} to all tests with test name "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 last test result A" - assert true: last test result of {_test::1} is a fail diff --git a/tests/working/utils/testframework.test.sk b/tests/working/utils/testframework.test.sk new file mode 100644 index 0000000..84dc0ec --- /dev/null +++ b/tests/working/utils/testframework.test.sk @@ -0,0 +1,104 @@ +local effect no errors\: <.+>: + trigger: + stop + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 assert true passes": + assert true: {_none} is not set + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 assert false passes": + assert false: {_none} is set + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 framework internal consistency": + without halting assert true: size of all tests > 0 + 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 + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 assert error message is stored": + without halting assert true with no error message "msg1": {_none} is set + assert true with message "check failed": test errors contains "msg1" + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 no error message produces empty suffix": + without halting assert true with no error message: {_none} is set + assert true: size of test errors is 1 + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 halting assert stops execution": + assert true with no error message: {_none} is set + broadcast "ERROR: this should never execute" + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 without halting continues execution": + without halting assert true with no error message: {_none} is set + assert true: {_none} is not set + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 fail test records error": + without halting fail test with no error message + assert true: size of test errors is 1 + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 fail test halts by default": + fail test with no error message + broadcast "ERROR: fail test did not halt" + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 autorun flag is true": + if event-test is not autorun: + stop + assert true: event-test is autorun + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 manual run flag is false" when {_none} is set: + fail test + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 manual run flag" when event-test is not autorun: + fail test if event-test is autorun + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 stop auto execution works": + if event-test is not autorun: + stop + stop auto test execution here + broadcast "ERROR: auto execution not stopped" + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 all tests returns this test": + set {_all::*} to all tests with test name "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 all tests returns this test" + assert true: size of {_all::*} > 0 + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 all tests": + set {_all::*} to all tests + assert true: size of {_all::*} > 0 + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 errors do not leak between tests A": + without halting assert true with no message: {_none} is set + assert true: size of test errors is 1 + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 errors do not leak between tests B": + assert true: size of test errors is 0 + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 event-test returns correct name": + assert true: event-test[0] is event-string + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 test-block is temporary A": + set {-test.sk::temptestblocka} to test-block's type + test block is chest: + set test-block to trapped chest + else if test block is trapped chest: + set test-block to chest + else: + set test-block to ender chest + set {-test.sk::temptestblockb} to test-block's type + +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 + +devdinc test "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 last test result B": + set {_test::*} to all tests with test name "f39f0f4a-31ee-4b71-87e9-38ddba3a2313 last test result A" + assert true: last test result of {_test::1} is a fail