بنقرة واحدة
write-tests
// Write spec-aligned Dada tests. Use when creating new test files, organizing tests to match the specification, or adding test coverage for language features.
// Write spec-aligned Dada tests. Use when creating new test files, organizing tests to match the specification, or adding test coverage for language features.
Conventions for authoring Rust code in the Dada compiler. Use when writing or modifying Rust code, adding functions, or making implementation changes.
RFC and specification workflow for Dada language features. Use when working with RFCs, writing spec paragraphs, or tracking implementation progress.
Track context across sessions for long-running features. Use when starting multi-session work, checkpointing progress, or resuming work on a feature tracked in a GitHub issue.
Run and interpret Dada test results. Use when running tests, debugging test failures, or understanding test output.
| name | write-tests |
| description | Write spec-aligned Dada tests. Use when creating new test files, organizing tests to match the specification, or adding test coverage for language features. |
Tests mirror the spec directory structure under tests/:
spec/src/syntax/string-literals.md → tests/syntax/string_literals/
spec/src/syntax/literals.md → tests/syntax/literals/
Within each test directory, organize by spec section:
tests/syntax/string_literals/
├── delimiters/
│ └── quoted.dada # #:spec syntax.string-literals.delimiters.quoted
├── type.dada # #:spec syntax.string-literals.type
├── escape_sequences/
│ ├── backslash.dada # #:spec syntax.string-literals.escape-sequences.backslash
│ ├── invalid.dada # #:spec syntax.string-literals.escape-sequences.invalid
│ └── ...
└── interpolation/
└── brace_escaping.dada # #:spec syntax.string-literals.interpolation.brace-escaping
Ad-hoc tests that don't correspond to a spec paragraph go in tests/adhoc/.
IDs are built from the spec file path and headings:
spec/src/syntax/string-literals.md → syntax.string-literals
README.md is special: only the parent directory becomes the prefix:::{spec} local_name directive
rfc0001, unimpl), there's no local name{spec}`name` inside a block# String Literals ← H1: skipped (in file prefix)
## Escape Sequences ← H2: "escape-sequences"
:::{spec} rfc0001 ← Block: no local name (rfc0001 is a tag)
* {spec}`backslash` `\\` produces... ← Inline: "backslash"
:::
:::{spec} invalid rfc0001 ← Block: local name = "invalid"
:::
Resulting IDs:
syntax.string-literals.escape-sequences (the block)syntax.string-literals.escape-sequences.backslash (inline)syntax.string-literals.escape-sequences.invalid (named block)#:spec syntax.string-literals.delimiters.quoted
#:skip_codegen
async fn main() {
print("hello").await
print("").await
}
#:spec syntax.string-literals.escape-sequences.invalid
#:skip_codegen
async fn main() {
print("\a").await
#! ^ /invalid escape
}
The ^ must be at the exact column of the error span on the previous line. Use /pattern (NO closing /) for regex matching.
#:spec syntax.string-literals.type
#:skip_codegen
fn main() {
let x = "hello"
#? ^ VariableType: String
}
VariableType shows the declared type without permissions. Use ExprType for expression types. Multiple ^^ carets match multi-byte spans.
The tokenizer's delimited() function doesn't skip over string literal contents when scanning for matching braces. Unbalanced { or } inside strings will confuse brace-depth tracking. Workaround: Use balanced \{...\} pairs in test strings:
# Good — balanced braces
print("\{\}").await
print("hello\{world\}").await
# Bad — unbalanced brace causes parse errors
print("\{").await
This will be fixed when string interpolation is implemented.
#:spec <paragraph-id> annotation#:skip_codegen if the test doesn't need WebAssembly generation#! annotations for expected errors or #? probes for type checkingcargo dada test --porcelain <test-file> to verify.test-report.md if the test fails