Skip to content

test: remove shallow parse-only smoke tests from compile.test.ts (#72)#148

Merged
thiagoralves merged 1 commit into
developmentfrom
fix/72-remove-parse-only-tests
Jun 1, 2026
Merged

test: remove shallow parse-only smoke tests from compile.test.ts (#72)#148
thiagoralves merged 1 commit into
developmentfrom
fix/72-remove-parse-only-tests

Conversation

@thiagoralves
Copy link
Copy Markdown
Contributor

Summary

Closes #72. Removes 82 shallow parse-only smoke tests from tests/integration/compile.test.ts. Each only did:

const result = parse(source);
expect(result.ast).toBeDefined();
expect(result.errors).toHaveLength(0);

— no AST-structure or codegen assertions. The constructs they touch (arithmetic/comparison/logical operators, control flow, literals, variable/type declarations, multi-POU) are exercised far more rigorously by the codegen-*.test.ts and cpp-compile/st-validation suites, which parse and generate and assert real C++ output. A parse-only "no errors" check is strictly weaker and adds nothing those provide.

136 → 54 tests in the file; full suite green (1917 passed, down exactly 82), typecheck clean. Diff is deletion-only (no quote/format churn — tests/ isn't covered by prettier --check src/).

Why this supersedes #79

I classified every it() in the current file. PR #79 (March, line-range based) was both incomplete and slightly over-broad:

  • Missed the two function-parsing sections — Parse Function Tests (5 shallow) and Function and Function Block Parsing Tests (4 shallow) — which sit before its "keep first 536 lines" cutoff but are shallow too.
  • Over-removed: deleted the whole Complex Program Tests section, including a meaningful compile()+success test.
  • Was a stale line-range diff against a file that has since grown to 2101 lines.

What was removed vs. kept

Removed in full: Function/FB Parsing, Expression Parsing, Chained Expression, Literal Types, Direct Address, Type Declaration, Additional Expression Edge Cases, Multiple POU, Variable Declaration, Control Flow Parsing, Edge Case.

Trimmed (kept the non-shallow cases):

  • Parse Function Tests → kept should return errors for invalid syntax (negative test) and should parse empty input (edge/contract).
  • Complex Program Tests → kept should parse configuration with VAR_GLOBAL and programs with VAR_EXTERNAL (compile() + success).

Untouched meaningful sections: Project Structure, Error Handling, Compiler Options, External Code Pragma, Future Integration.

🤖 Generated with Claude Code

These 82 tests each parsed a snippet and asserted only `ast` defined +
`errors` empty — no AST-structure or codegen assertions. The constructs
they touch (arithmetic/comparison/logical operators, control flow,
literals, variable/type declarations, multi-POU) are all exercised far
more rigorously by the codegen-*.test.ts and cpp-compile/st-validation
suites, which parse *and* generate *and* assert real C++ output. A
parse-only "no errors" check is strictly weaker and adds no coverage
those provide.

Removed in full: Function/FB Parsing, Expression Parsing, Chained
Expression, Literal Types, Direct Address, Type Declaration, Additional
Expression Edge Cases, Multiple POU, Variable Declaration, Control Flow
Parsing, Edge Case. Trimmed: Parse Function Tests and Complex Program
Tests keep only their non-shallow cases.

Deliberately KEPT (not shallow): the negative test (`returns errors for
invalid syntax`), the empty-input edge test, and the compile()-based
VAR_GLOBAL/VAR_EXTERNAL success test.

Supersedes #79, which missed the two function-parsing sections (they sit
before its "keep first 536 lines" cutoff) and over-removed the
compile()-based Complex Program test. 136 -> 54 tests; full suite green
(1917 passed), typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@thiagoralves thiagoralves merged commit 8fcf166 into development Jun 1, 2026
@thiagoralves thiagoralves deleted the fix/72-remove-parse-only-tests branch June 1, 2026 19:32
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.

refactor: delete ~1100 redundant parse-only tests from compile.test.ts

1 participant