0a36a454f9
- New crate el-test: test discovery, in-memory graph seeding, assertion evaluator, TestRunner, TestReport with human/JSON/JUnit XML output - New keywords: test, seed, assert, target — fully integrated into lexer, parser, codegen, type-checker - Parser extensions: TestDef, SeedStmt, Assert AST nodes; seed blocks handle type: as field name (keyword-as-ident in seed context) - Debugger: DebugEvent, Debugger, StepMode, StackFrame in el-compiler — breakpoints, step-over, step-into, step-out - CLI: el test-file <file.el> runs tests; el test integrates with project; el debug attaches debugger; --output json|junit for CI - 52 new tests in el-test covering discovery, graph seeding, assertion evaluation, pass/fail/error/skip, report generation, JUnit XML - Example: examples/hello-project/src/tests.el — 6 unit tests pass, 1 e2e test correctly skipped without ENGRAM_URL
58 lines
1.4 KiB
EmacsLisp
58 lines
1.4 KiB
EmacsLisp
// Engram language — example test file
|
|
// Run with: el test-file examples/hello-project/src/tests.el
|
|
|
|
test "basic arithmetic" {
|
|
let x: Int = 6
|
|
let y: Int = 7
|
|
let result: Int = x * y
|
|
assert result == 42
|
|
}
|
|
|
|
test "string operations" {
|
|
let greeting: String = "Hello"
|
|
let name: String = "Engram"
|
|
let full: String = greeting + ", " + name
|
|
assert full == "Hello, Engram"
|
|
}
|
|
|
|
test "type graph has Point type" {
|
|
seed Node {
|
|
type: "Point"
|
|
content: "A 2D coordinate"
|
|
importance: 0.8
|
|
tier: Semantic
|
|
}
|
|
|
|
let results = activate Point where "coordinate"
|
|
assert results.len() > 0
|
|
}
|
|
|
|
test "empty graph" {
|
|
let results = activate Customer where "anything"
|
|
assert results.len() == 0
|
|
}
|
|
|
|
test "empty graph returns insufficient" {
|
|
let result = reason("Is there a customer named Will?")
|
|
assert result.verdict == "Insufficient"
|
|
}
|
|
|
|
test "seeded graph reasoning" {
|
|
seed Node {
|
|
type: "Customer"
|
|
content: "Will Anderson, founding member"
|
|
importance: 0.9
|
|
tier: Semantic
|
|
}
|
|
|
|
let result = reason("founding member")
|
|
assert result.verdict == "Supported"
|
|
}
|
|
|
|
test "production customer lookup" target: e2e {
|
|
// No seeds — uses the real Engram database
|
|
// (skipped when ENGRAM_URL is not set)
|
|
let results = activate Customer where "founding member"
|
|
assert results.len() > 0
|
|
}
|