Skip to content

Conversation

@devdinc
Copy link
Owner

@devdinc devdinc commented Jan 16, 2026

Changes

Project Structure

  • Reorganized scripts into scripts/libs/ and scripts/utils/ directories
  • Moved test files from test/ to tests/ directory
  • Consolidated test framework into scripts/utils/testframework.sk

CI/CD

  • Added GitHub Actions workflow for automated testing (test-skripts.yml)
  • Configured workflow to run on stable and dev branches
  • Updated wiki publishing workflow to trigger on stable branch

Testing Framework Enhancements

  • Improved assertion syntax for better readability
  • Expanded documentation with comprehensive feature descriptions
  • Added experimental parse section and log inspection capabilities
  • Enhanced test execution with autorun control and conditional execution

Test Updates

  • Updated all test files to use new assertion syntax
  • Improved test isolation and error tracking
  • Added test utilities for controlled test fixtures

Summary by CodeRabbit

  • New Features

    • Implemented comprehensive testing framework with assertion tools, test utilities, and automated test orchestration
    • Added automated test execution via GitHub Actions on push and pull request events
  • Documentation

    • Significantly expanded testing framework documentation with detailed specifications, design goals, and usage patterns
  • Tests

    • Reorganized and expanded test suites with functional programming and routine behavior validation
    • Refined test assertions for improved clarity and consistency
  • Chores

    • Updated GitHub Actions workflows to trigger publishing and testing on appropriate branches

✏️ Tip: You can customize this high-level summary in your review settings.

@devdinc
Copy link
Owner Author

devdinc commented Jan 16, 2026

@coderabbitai why did you skip review

@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

# Get PR details including body, labels, and basic info
gh pr view 5 --json title,body,state,files,additions,deletions,comments,labels,author

# Check if there are any CodeRabbit comments on the PR
gh pr view 5 --comments | grep -A 10 -i "coderabbit\|skip"

# List the files changed in the PR
gh pr diff 5 --name-only

Length of output: 2160


🏁 Script executed:

#!/bin/bash

# Check if there's a .coderabbit.yaml or .coderabbit.yml configuration file
fd -t f "coderabbit.ya?ml" -H

# Also check for any configuration in package.json or other common locations
fd -t f "package.json|.github" -d 2 | xargs -I {} sh -c 'echo "=== {} ===" && cat {}'

Length of output: 0


🏁 Script executed:

#!/bin/bash

# List top-level directory structure
echo "=== Repository Structure ==="
ls -la

# Check if .github directory exists and list contents
if [ -d ".github" ]; then
    echo -e "\n=== .github directory ==="
    ls -la .github/
    if [ -d ".github/workflows" ]; then
        echo -e "\n=== Workflows ==="
        ls -la .github/workflows/
    fi
fi

# Check for any hidden yaml files that might be configuration
echo -e "\n=== Looking for configuration files ==="
find . -maxdepth 2 -name "*.yml" -o -name "*.yaml" | head -20

Length of output: 1029


@devdinc I'm investigating why the review was skipped for this PR. Let me check the CodeRabbit configuration and status for this repository.


🛠 Debug Information Gathered


@devdinc The review was skipped because your configuration has reviews.review_status set to false. This setting prevents CodeRabbit from posting status messages that would normally explain why a review was skipped.

Additionally, your PR title is set to "@coderabbitai", which is configured as your auto_title_placeholder. This placeholder is intended to trigger automatic title generation, but it works best when combined with a descriptive PR body. With an empty body and only the placeholder as the title, CodeRabbit may be waiting for actual PR content before proceeding with the review.

Recommended fixes:

  1. Enable review status messages by setting reviews.review_status: true in your CodeRabbit configuration. This will ensure you receive explanations when reviews are skipped.

  2. Add a PR description that explains the changes, or replace the "@coderabbitai" title with a descriptive title. The auto_title_placeholder works by analyzing your PR description and changes to generate an appropriate title.

Would you like me to trigger a review of this PR now?

@devdinc
Copy link
Owner Author

devdinc commented Jan 16, 2026

Tip

For best results, initiate chat on the files or code changes.
🧩 Analysis chain

@devdinc The review was skipped because your configuration has reviews.review_status set to false. This setting prevents CodeRabbit from posting status messages that would normally explain why a review was skipped.

Additionally, your PR title is set to "@coderabbitai", which is configured as your auto_title_placeholder. This placeholder is intended to trigger automatic title generation, but it works best when combined with a descriptive PR body. With an empty body and only the placeholder as the title, CodeRabbit may be waiting for actual PR content before proceeding with the review.

Recommended fixes:

1. **Enable review status messages** by setting `reviews.review_status: true` in your CodeRabbit configuration. This will ensure you receive explanations when reviews are skipped.

2. **Add a PR description** that explains the changes, or replace the "@coderabbitai" title with a descriptive title. The auto_title_placeholder works by analyzing your PR description and changes to generate an appropriate title.

Would you like me to trigger a review of this PR now?

@coderabbitai yes trigger a review.

@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

@devdinc I will trigger a review of this PR now.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devdinc
Copy link
Owner Author

devdinc commented Jan 16, 2026

@coderabbitai just change title and body.

@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

# Get the PR diff to understand what changes were made
echo "=== PR Diff ==="
gh pr diff 5

# Get more details about the files changed
echo -e "\n=== Files Changed ==="
gh pr view 5 --json files,additions,deletions -q '.files[] | "\(.path): +\(.additions) -\(.deletions)"'

Length of output: 49365


🏁 Script executed:

#!/bin/bash

# Update PR title and body
gh pr edit 5 \
  --title "Refactor project structure and enhance testing framework" \
  --body "## Changes

### Project Structure
- Reorganized scripts into \`scripts/libs/\` and \`scripts/utils/\` directories
- Moved test files from \`test/\` to \`tests/\` directory
- Consolidated test framework into \`scripts/utils/testframework.sk\`

### CI/CD
- Added GitHub Actions workflow for automated testing (\`test-skripts.yml\`)
- Configured workflow to run on \`stable\` and \`dev\` branches
- Updated wiki publishing workflow to trigger on \`stable\` branch

### Testing Framework Enhancements
- Improved assertion syntax for better readability
- Expanded documentation with comprehensive feature descriptions
- Added experimental parse section and log inspection capabilities
- Enhanced test execution with autorun control and conditional execution

### Test Updates
- Updated all test files to use new assertion syntax
- Improved test isolation and error tracking
- Added test utilities for controlled test fixtures"

Length of output: 298


@devdinc I cannot directly update the PR title and body due to workflow restriction settings on this repository. However, here is the suggested content you can use to update it manually:

Title:

Refactor project structure and enhance testing framework

Body:

## Changes

### Project Structure
- Reorganized scripts into `scripts/libs/` and `scripts/utils/` directories
- Moved test files from `test/` to `tests/` directory
- Consolidated test framework into `scripts/utils/testframework.sk`

### CI/CD
- Added GitHub Actions workflow for automated testing (`test-skripts.yml`)
- Configured workflow to run on `stable` and `dev` branches
- Updated wiki publishing workflow to trigger on `stable` branch

### Testing Framework Enhancements
- Improved assertion syntax for better readability
- Expanded documentation with comprehensive feature descriptions
- Added experimental parse section and log inspection capabilities
- Enhanced test execution with autorun control and conditional execution

### Test Updates
- Updated all test files to use new assertion syntax
- Improved test isolation and error tracking
- Added test utilities for controlled test fixtures

You can update these directly in the GitHub UI by editing the PR.

@devdinc devdinc changed the title @coderabbitai Refactor project structure and enhance testing framework Jan 16, 2026
@devdinc devdinc merged commit 7a5e267 into stable Jan 16, 2026
2 of 3 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

Walkthrough

This pull request migrates the test framework from a root-level implementation to a new structured approach under scripts/utils/testframework.sk, reorganizes test files from test/ to tests/, updates comprehensive framework documentation, and introduces a GitHub Actions workflow for automated test execution on stable and dev branches.

Changes

Cohort / File(s) Summary
GitHub Actions Workflows
.github/workflows/publish-wiki.yml, .github/workflows/test-skripts.yml
Modified publish-wiki trigger from main to stable branch. Introduced new test-skripts workflow with triggers on workflow_dispatch, push to stable/dev with path filters, and pull requests; downloads dependencies and executes tests via devdinc/skript-test-action with vanilla tests disabled.
Test Framework Documentation
docs/testframework.md
Comprehensive rewrite consolidating fragmented specifications into unified Skript Runtime Testing Framework documentation. Reorganized into 20+ sections covering design goals, architecture, test registration, running, discovery, assertions, error tracking, and guarantees. Updated syntax patterns and event context definitions.
Test Framework Implementation
scripts/utils/testframework.sk, testframework.sk
Replaced old root-level test framework (130 lines removed) with new implementation (331 lines added) in scripts/utils/. Introduces skriptTest event, run tests effect, assert/fail test effects, test discovery expressions, autorun management, and parse inspection utilities.
Test Suite Migration
test/functionsv2.sk, test/main.sk, test/routines.sk, tests/functionsv2.sk, tests/routines.sk, tests/singlinesection.sk
Removed old test definitions from root test/ directory (135 lines deleted). Added new test suite under tests/ directory with functionsv2 tests (107 lines covering supplier/consumer/function patterns), routines tests (13 lines with URL-based assertions), and updated singlinesection assertions to use direct value comparisons.

Sequence Diagram

sequenceDiagram
    participant Parser as Script Parser
    participant Registry as Test Registry
    participant Executor as Test Executor
    participant Assertions as Assertion Engine
    participant Output as Console Output

    Parser->>Registry: skriptTest event fires<br/>(test "name" [when condition])
    Registry->>Registry: Register test with<br/>condition evaluation
    
    alt User Command: run tests
        Executor->>Registry: Query all registered tests
        Registry-->>Executor: Return test list
    end
    
    loop For each test
        Executor->>Executor: Evaluate when condition
        alt Condition met
            Executor->>Assertions: Execute test block
            Assertions->>Assertions: Collect assertions<br/>and errors
            Assertions-->>Executor: Return results
        end
    end
    
    Executor->>Output: Print summary<br/>(passed/failed counts)
    Output-->>Executor: Display results
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: refactoring project structure (file reorganization, workflow updates) and enhancing the testing framework (new comprehensive framework in scripts/utils/testframework.sk with supporting workflow and documentation).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (2)
.github/workflows/test-skripts.yml (1)

37-56: Redundant directory creation.

mkdir -p build/libs is called three times across steps (lines 39, 44, 50). The -p flag makes subsequent calls harmless, but consolidating these into the first step improves readability.

Suggested consolidation
      - name: Pre-create plugin directory
        run: |
          mkdir -p build/libs
          mkdir -p build/libs/skript-reflect

      - name: Download Skript-Reflect
        run: |
-          mkdir -p build/libs
          curl -L -o build/libs/skript-reflect.jar \
            https://github.com/SkriptLang/skript-reflect/releases/download/v2.6.1/skript-reflect-2.6.1.jar
            
      - name: Download Routines from JitPack
        run: |
-          mkdir -p build/libs
      
          curl -L --fail -o build/libs/skript-reflect/routines-core.jar \
docs/testframework.md (1)

78-84: Add language specifiers to code blocks.

Several code blocks are missing language identifiers. Based on static analysis, the blocks at lines 81, 96, 328, 336, and 351 should specify a language for proper rendering.

Suggested fixes

For the internal storage format examples (lines 96-99, 328-330), use text or plaintext:

-```
+```text
 -test.sk::tests::<script>::<test name>

For the output format examples (lines 336-338, 351-353), also use `text`:

```diff
-```
+```text
 <X>/<Y> tests passed

```diff
-```
+```text
 [Skript] [TEST FAILURE] <test name> <optional message>

For the identifier format example (lines 130-133):

```diff
-```
+```text
 <script>/<test name>
</details>


Also applies to: 94-99, 326-331, 334-339, 349-354

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used**: Organization UI

**Review profile**: CHILL

**Plan**: Pro

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between d11538f8b12788f841ccaa8f61148ce1f6edfe6a and 20704f10fd6e44c41d7ec2a26567332f9d00d44c.

</details>

<details>
<summary>📒 Files selected for processing (17)</summary>

* `.github/workflows/publish-wiki.yml`
* `.github/workflows/test-skripts.yml`
* `docs/testframework.md`
* `scripts/libs/functionsv2.sk`
* `scripts/libs/pdc.sk`
* `scripts/libs/routines.sk`
* `scripts/libs/singlelinesection.sk`
* `scripts/utils/configreloadv2.sk`
* `scripts/utils/testframework.sk`
* `scripts/utils/worldproperties.sk`
* `test/functionsv2.sk`
* `test/main.sk`
* `test/routines.sk`
* `testframework.sk`
* `tests/functionsv2.sk`
* `tests/routines.sk`
* `tests/singlinesection.sk`

</details>

<details>
<summary>💤 Files with no reviewable changes (4)</summary>

* test/routines.sk
* test/functionsv2.sk
* test/main.sk
* testframework.sk

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.18.1)</summary>

<details>
<summary>docs/testframework.md</summary>

81-81: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

96-96: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

328-328: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

336-336: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

351-351: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

</details>

<details>
<summary>🔇 Additional comments (14)</summary><blockquote>

<details>
<summary>.github/workflows/publish-wiki.yml (1)</summary><blockquote>

`4-4`: **Branch trigger alignment looks correct.**

The change from `main` to `stable` aligns with the repository's branching strategy where `stable` serves as the primary branch for releases.

</blockquote></details>
<details>
<summary>.github/workflows/test-skripts.yml (1)</summary><blockquote>

`59-66`: **Script preparation logic is reasonable.**

The rsync approach and selective file removal handle the test environment setup appropriately. The `0_` prefix on `singlelinesection.sk` ensures it loads first, which is a common pattern for dependency ordering in Skript.

</blockquote></details>
<details>
<summary>tests/routines.sk (2)</summary><blockquote>

`4-9`: **Test logic correctly validates routine execution patterns.**

The test covers both direct Java constructor calls via async context and Skript function invocations through the fluent routine API. The assertions verify string representations appropriately.

---

`12-13`: **Function definition is correct.**

The comment clarifies the non-local requirement. The `object` return type is appropriate since `URL` is a Java type.

</blockquote></details>
<details>
<summary>tests/functionsv2.sk (5)</summary><blockquote>

`1-10`: **Supplier and getter tests provide good coverage.**

Tests validate both lambda syntax and named supplier/getter constructs with various expression types.

---

`12-19`: **Runnable test correctly validates side effects.**

The pattern of clearing global state before running and asserting after is appropriate for side-effect verification.

---

`22-55`: **Consumer, function, and bi-variant tests are thorough.**

Coverage includes single-argument and bi-argument variants with appropriate state clearing between tests.

---

`58-86`: **Repeated invocation and stream tests validate stateful behavior.**

The consumer repeat test verifies accumulation across multiple calls. The Java stream test demonstrates interoperability with Java collections API.

---

`89-107`: **Edge case and helper tests provide valuable coverage.**

The negative test on line 96 correctly validates that real variable lists are rejected with `to fail` assertion. Lambda helper tests verify the `run lambda` utility syntax.

</blockquote></details>
<details>
<summary>docs/testframework.md (3)</summary><blockquote>

`5-56`: **Documentation structure and content are well-organized.**

The overview, design goals, and feature parity sections clearly establish the framework's purpose and scope. The table format for feature parity is effective for quick reference.

---

`155-214`: **Assertion and error tracking documentation is comprehensive.**

The syntax variants, modifiers, and behavior descriptions provide sufficient detail for users to implement tests correctly.

---

`216-287`: **Autorun semantics are clearly documented.**

The distinction between autorun and manual execution modes is well-explained with practical usage patterns.

</blockquote></details>
<details>
<summary>scripts/utils/testframework.sk (1)</summary><blockquote>

`54-85`: **Test execution flow and cleanup look solid.**

Clearing per-test errors, tracking failures, and restoring the test block helps keep runs isolated.

</blockquote></details>
<details>
<summary>tests/singlinesection.sk (1)</summary><blockquote>

`4-27`: **Assertions now validate concrete values.**

The updated checks are clearer and less dependent on error-string matching.

</blockquote></details>

</blockquote></details>

<sub>✏️ Tip: You can disable this entire section by setting `review_details` to `false` in your review settings.</sub>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment on lines +26 to +27
permissions:
contents: write
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Fetch the action.yml from devdinc/skript-test-action
curl -sL "https://api.github.com/repos/devdinc/skript-test-action/contents/action.yml?ref=v1.3" | jq -r '.content' 2>/dev/null | base64 -d 2>/dev/null | head -50

Repository: devdinc/skripts

Length of output: 1148


🏁 Script executed:

# Also check the repository to see if the action needs write permissions
curl -sL "https://raw.githubusercontent.com/devdinc/skript-test-action/v1.3/action.yml" | head -60

Repository: devdinc/skripts

Length of output: 1148


🏁 Script executed:

# Check the workflow file to see what operations are being performed
git ls-files | grep -E "test-skripts\.yml"

Repository: devdinc/skripts

Length of output: 93


🏁 Script executed:

# Get the full workflow file to examine all steps
cat .github/workflows/test-skripts.yml | head -100

Repository: devdinc/skripts

Length of output: 2467


Reduce permissions scope from contents: write to contents: read.

The workflow only performs read operations on the repository and does not write any changes back. The test action (devdinc/skript-test-action@v1.3) runs via Docker and does not declare permission requirements. Local filesystem operations like mkdir and rsync operate within the working directory and do not require repository write access. Use contents: read to follow the principle of least privilege.

Comment on lines +69 to +82
- name: Run tests
uses: devdinc/skript-test-action@v1.3
with:
skript_repo_url: https://github.com/devdinc/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: copy-dir-resources # 2.13.2

# directory containing addon/plugin jars (relative to repo root)
extra_plugins_directory: build/libs

run_vanilla_tests: false
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Attempt to check the action repository via web (without gh CLI authentication requirement)
# First, check if we can reach GitHub
curl -s -I https://github.com/devdinc/skript-test-action 2>&1 | head -5
echo "---"
# Try to fetch the release info
curl -s https://api.github.com/repos/devdinc/skript-test-action/releases/tags/v1.3 2>&1 | head -20

Repository: devdinc/skripts

Length of output: 1466


🌐 Web query:

devdinc/skript-test-action GitHub repository action

💡 Result:

I couldn't find a GitHub repository or published Action named "devdinc/skript-test-action" on GitHub. Please check the repository name or share a link — I can search again or inspect the repo if you provide the URL.


🏁 Script executed:

#!/bin/bash
# Check if action.yml exists in the repository
curl -s https://raw.githubusercontent.com/devdinc/skript-test-action/main/action.yml 2>&1 | head -50
echo "---"
# Also try master branch in case
curl -s https://raw.githubusercontent.com/devdinc/skript-test-action/master/action.yml 2>&1 | head -50

Repository: devdinc/skripts

Length of output: 1954


Remove the undefined skript_repo_url parameter.

The external action devdinc/skript-test-action@v1.3 exists and is properly configured for most parameters. However, skript_repo_url is not an accepted input by this action and will be silently ignored. The action accepts only: test_script_directory, skript_repo_ref, run_vanilla_tests, and extra_plugins_directory. Remove the skript_repo_url line or verify with the action maintainer if this parameter serves a different purpose.

Comment on lines +76 to +77
# Skript version or ref (tag, branch, or commit)
skript_repo_ref: copy-dir-resources # 2.13.2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Branch ref may cause non-reproducible builds.

Using branch name copy-dir-resources instead of a tagged version (e.g., 2.13.2) means the workflow behavior can change unexpectedly when the branch is updated. Consider pinning to a specific commit SHA or tagged release for reproducibility.

Comment on lines +1 to +3
Below is a **single, unified Markdown document** that combines both inputs, removes duplication, and reconciles terminology while preserving all technical detail. Structure has been normalized so it reads as one authoritative specification rather than two overlapping documents.

## Purpose
---
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove meta-commentary from document.

Line 1 contains editorial meta-text describing the document creation process. This should be removed from the final specification.

Suggested fix
-Below is a **single, unified Markdown document** that combines both inputs, removes duplication, and reconciles terminology while preserving all technical detail. Structure has been normalized so it reads as one authoritative specification rather than two overlapping documents.
-
 ---
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Below is a **single, unified Markdown document** that combines both inputs, removes duplication, and reconciles terminology while preserving all technical detail. Structure has been normalized so it reads as one authoritative specification rather than two overlapping documents.
## Purpose
---
---

Comment on lines +93 to +113
parse:
set {_raw} to first element of regex-1

set {_parser} to ParserInstance.get()
set {_parser}.[ParserInstance]isActive to true
set {_backup} to {_parser}.backup()

{_parser}.setCurrentScript(current script)
{_parser}.setCurrentEvent("assert condition", (custom event "skriptTest").getClass())

set {_cond} to Condition.parse({_raw}, "Can't understand condition: " + {_raw})

set {_parser}.[ParserInstance]isActive to false
{_parser}.restoreBackup({_backup})
continue
trigger:
set {_ok} to {_cond}.check(event)

set {_label} to "assert true" if parse tags contains "1" else "assert false"
set {_test} to event.getEventValue("string")
if all:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

fd -t f testframework.sk

Repository: devdinc/skripts

Length of output: 89


🏁 Script executed:

cat -n scripts/utils/testframework.sk | head -150

Repository: devdinc/skripts

Length of output: 6869


🏁 Script executed:

cat -n scripts/utils/testframework.sk | sed -n '125,135p'

Repository: devdinc/skripts

Length of output: 636


Guard against null condition parsing result before invoking check().

The assert effect at line 103 parses a condition without guarding against null, but line 109 immediately calls .check(event) on a potentially null result. This differs from the event check block (lines 22-27) which properly guards: if {_cond} is set: {_cond}.check(event). If parsing fails, a NullPointerException masks the actual parse error. Add the guard and record the failure early.

Proposed fix
 trigger:
-    set {_ok} to {_cond}.check(event)
-    
-    set {_label} to "assert true" if parse tags contains "1" else "assert false"
     set {_test} to event.getEventValue("string")
+    if {_cond} is not set:
+        testFail "Test ""%{_test}%"" has an invalid assert condition ""%{_raw}%"""
+        add "invalid condition: %{_raw}%" to {-test.sk::errors::%{_test}%::*}
+        if parse tags contains "3":
+            delay effect
+        stop
+    set {_ok} to {_cond}.check(event)
+    set {_label} to "assert true" if parse tags contains "1" else "assert false"

Comment on lines +211 to +221
plural expression test errors[ for [test[s]] %-strings%]:
return type: strings
get:
if expr-1 is not set:
set {_test} to event.getEventValue("string")
return {-test.sk::errors::%{_test}%::*}
else:
loop ...expr-1:
set {_test} to loop-value
add {-test.sk::errors::%{_test}%::*} to {_r::*}
return {_r::*}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Reset the accumulator before building the error list.

{_r::*} can retain values across multiple calls in the same event. Clearing avoids cross-test contamination.

Proposed fix
 get:
+    delete {_r::*}
     if expr-1 is not set:
         set {_test} to event.getEventValue("string")
         return {-test.sk::errors::%{_test}%::*}
     else:
         loop ...expr-1:
             set {_test} to loop-value
             add {-test.sk::errors::%{_test}%::*} to {_r::*}
         return {_r::*}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
plural expression test errors[ for [test[s]] %-strings%]:
return type: strings
get:
if expr-1 is not set:
set {_test} to event.getEventValue("string")
return {-test.sk::errors::%{_test}%::*}
else:
loop ...expr-1:
set {_test} to loop-value
add {-test.sk::errors::%{_test}%::*} to {_r::*}
return {_r::*}
plural expression test errors[ for [test[s]] %-strings%]:
return type: strings
get:
delete {_r::*}
if expr-1 is not set:
set {_test} to event.getEventValue("string")
return {-test.sk::errors::%{_test}%::*}
else:
loop ...expr-1:
set {_test} to loop-value
add {-test.sk::errors::%{_test}%::*} to {_r::*}
return {_r::*}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants