-
Notifications
You must be signed in to change notification settings - Fork 5
feat: test init #95
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
feat: test init #95
Conversation
Caution Review failedFailed to post review comments WalkthroughAdds a new CLI subcommand to initialize test specs from a NumScript file, refactors test command argument handling, extends specs/test format with focus/skip, postings, and end-balance expectations (including subset checks), updates runner UI and skip logic, introduces map-include utilities, and adds a balance-inclusion comparator with tests. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant CLI as test-init CLI
participant FS as File System
participant P as Parser
participant IR as Interpreter
participant S as TestInitStore
U->>CLI: run test-init <path/to/script.ns>
CLI->>FS: Read NumScript file
CLI->>P: Parse program
P-->>CLI: AST or parse error
alt parse error
CLI-->>U: Print error and exit(1)
else parsed
CLI->>CLI: Extract vars, mkDefaultVar(...)
CLI->>IR: RunProgram(AST, S)
IR-->>CLI: Result (postings) or runtime error
alt runtime error
CLI-->>U: Panic/abort (iErr)
else success
CLI->>CLI: Build Specs{schema, balances, vars, tests}
CLI->>FS: Write <script>.specs.json
CLI-->>U: Print success message
end
end
sequenceDiagram
autonumber
participant SF as SpecsFormat.Check
participant TC as TestCase loop
participant IR as Interpreter
participant CMP as Balance Comparators
SF->>TC: Pre-scan tests for Focus
loop For each test
alt Focus exists and test not focused
TC-->>SF: Mark Skipped
else Run
TC->>IR: Execute program
IR-->>TC: Result (postings, balances/meta)
alt Expect endBalances
TC->>CMP: CompareBalances (exact)
CMP-->>TC: bool
end
alt Expect endBalances.include
TC->>CMP: CompareBalancesIncluding (subset)
CMP-->>TC: bool
end
TC-->>SF: Record pass/fail with postings
end
end
SF-->>SF: Aggregate passed/failed/skipped counts
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #95 +/- ##
==========================================
- Coverage 71.32% 69.31% -2.01%
==========================================
Files 41 43 +2
Lines 4631 4931 +300
==========================================
+ Hits 3303 3418 +115
- Misses 1176 1357 +181
- Partials 152 156 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
54bdd17
to
952c1a7
Compare
No description provided.