Context
The :modules:compiler:core test suite currently has two structural problems that make it harder to navigate and maintain as coverage grows.
Problem 1 — Test helpers live in src/main
Three files that exist purely to support tests are compiled into the main source set:
src/main/java/com/orca/compiler/core/tests/CompilerTestHelper.java
src/main/java/com/orca/compiler/core/tests/SourceBuilder.java
src/main/java/com/orca/compiler/core/tests/TopLevelSourceBuilder.java
Because they are in src/main, they end up on the production classpath and are included in any build artifact. They should live under src/test/java/…/tests/ instead, where they are only compiled for the test task and never shipped.
Goal: move all three files to src/test/java/com/orca/compiler/core/tests/ and confirm the test suite still passes.
Problem 2 — All test classes are flat and some are too large
All five test classes sit directly in com.orca.compiler.core with no sub-grouping. Two of them are approaching 1 000 lines:
| File |
Lines |
Sections |
TestCodeGen.java |
~992 |
16 sections |
TestTypeChecker.java |
~910 |
10 sections |
TestParser.java |
~390 |
— |
TestLexer.java |
~283 |
— |
TestTypeSystem.java |
~220 |
— |
Splitting by compiler phase and logical grouping would mirror the structure already used in src/main and make it clear where to add or remove tests.
Proposed layout
src/test/java/com/orca/compiler/core/
tests/ ← helpers moved from src/main
CompilerTestHelper.java
SourceBuilder.java
TopLevelSourceBuilder.java
lexer/
LexerTest.java
parser/
ParserTest.java
typesystem/
TypeSystemTest.java
semantic/
SemanticTest.java ← structural typing, type checks (valid + multi-source)
SemanticScopeTest.java ← scope/declarations, definite assignment, return statements
SemanticDeclTest.java ← constants, operators, impl blocks, collections
codegen/
ExpressionCodeGenTest.java ← literals, arithmetic (int+float), strings, booleans, comparisons
ControlFlowCodeGenTest.java ← variables, if/else, while, for
FunctionCodeGenTest.java ← functions, impl methods, built-in functions
CollectionCodeGenTest.java ← arrays, collections
IntegrationCodeGenTest.java ← any type, compound/integration tests
The split boundaries above are proposals — feel free to adjust groupings during implementation.
TestTypeChecker is renamed to SemanticTest (and friends) because the test class covers the full semantic analysis phase, which lives entirely in the Binder — there is no distinct TypeChecker pass.
Acceptance criteria
Context
The
:modules:compiler:coretest suite currently has two structural problems that make it harder to navigate and maintain as coverage grows.Problem 1 — Test helpers live in
src/mainThree files that exist purely to support tests are compiled into the main source set:
src/main/java/com/orca/compiler/core/tests/CompilerTestHelper.javasrc/main/java/com/orca/compiler/core/tests/SourceBuilder.javasrc/main/java/com/orca/compiler/core/tests/TopLevelSourceBuilder.javaBecause they are in
src/main, they end up on the production classpath and are included in any build artifact. They should live undersrc/test/java/…/tests/instead, where they are only compiled for the test task and never shipped.Goal: move all three files to
src/test/java/com/orca/compiler/core/tests/and confirm the test suite still passes.Problem 2 — All test classes are flat and some are too large
All five test classes sit directly in
com.orca.compiler.corewith no sub-grouping. Two of them are approaching 1 000 lines:TestCodeGen.javaTestTypeChecker.javaTestParser.javaTestLexer.javaTestTypeSystem.javaSplitting by compiler phase and logical grouping would mirror the structure already used in
src/mainand make it clear where to add or remove tests.Proposed layout
Acceptance criteria
CompilerTestHelper,SourceBuilder, andTopLevelSourceBuilderare moved tosrc/testsrc/main