// ---
// tags: trident, rust
// crystal-type: source
// crystal-domain: comp
// ---
use super::trident_grammar;

#[test]
fn grammar_json_roundtrip() {
    let grammar = trident_grammar();
    let json = grammar.to_json();
    // Verify it produces valid JSON with expected structure
    assert!(json.starts_with('{'));
    assert!(json.contains("\"name\": \"trident\""));
    assert!(json.contains("\"source_file\""));
}

#[test]
fn rule_count() {
    let grammar = trident_grammar();
    // 59 rules in the existing grammar.json
    assert_eq!(
        grammar.rules.len(),
        59,
        "expected 59 grammar rules, got {}",
        grammar.rules.len()
    );
}

#[test]
fn first_and_last_rules() {
    let grammar = trident_grammar();
    assert_eq!(grammar.rules.first().map(|r| r.0), Some("source_file"));
    assert_eq!(grammar.rules.last().map(|r| r.0), Some("line_comment"));
}

#[test]
fn extras_are_whitespace_and_comments() {
    let grammar = trident_grammar();
    assert_eq!(grammar.extras.len(), 2);
}

Homonyms

neural/trident/src/deploy/tests.rs
cyb/honeycrisp/aruminium/src/tests.rs
soft3/lens/cli/src/tests.rs
soft3/radio/iroh-blobs/src/tests.rs
neural/trident/src/package/manifest/tests.rs
neural/trident/src/verify/synthesize/tests.rs
neural/trident/src/lsp/util/tests.rs
cyb/wysm/crates/collections/src/tests.rs
soft3/radio/quinn/quinn/src/tests.rs
neural/trident/src/verify/report/tests.rs
cyb/wysm/crates/wasmi/src/tests.rs
neural/trident/src/syntax/lexer/tests.rs
neural/trident/src/cost/stack_verifier/tests.rs
cyb/honeycrisp/aruminium/src/render/tests.rs
neural/trident/src/package/store/tests.rs
neural/trident/src/verify/sym/tests.rs
neural/trident/src/config/scaffold/tests.rs
neural/trident/src/package/registry/tests.rs
neural/trident/src/verify/equiv/tests.rs
neural/trident/src/verify/solve/tests.rs
neural/trident/src/ir/lir/tests.rs
neural/trident/src/package/hash/tests.rs
neural/trident/src/verify/smt/tests.rs
neural/trident/src/syntax/format/tests.rs
neural/trident/src/lsp/semantic/tests.rs
soft3/radio/quinn/quinn-udp/tests/tests.rs
cyb/wysm/crates/cli/src/tests.rs
neural/trident/src/config/resolve/tests.rs
cyb/wysm/crates/wasmi/src/instance/tests.rs
cyb/wysm/crates/core/src/memory/tests.rs
neural/trident/src/neural/data/tir_graph/tests.rs
neural/trident/src/ir/tir/optimize/tests.rs
cyb/wysm/crates/core/src/table/tests.rs
neural/trident/src/ir/tir/stack/tests.rs
cyb/evy/forks/bevy_ecs/src/bundle/tests.rs
neural/trident/src/ir/tir/lower/tests.rs
soft3/radio/quinn/quinn-proto/src/range_set/tests.rs
cyb/wysm/crates/wasmi/src/module/instantiate/tests.rs
cyb/honeycrisp/.claude/worktrees/agent-aa1259cb10112b22a/aruminium/src/tests.rs
neural/inf/rs/cozo/cozo-core/src/runtime/tests.rs
cyb/honeycrisp/.claude/worktrees/agent-ad6c77c38e86bc291/aruminium/src/tests.rs
cyb/wysm/crates/wasmi/src/engine/limits/tests.rs
cyb/evy/forks/naga/src/front/wgsl/tests.rs
cyb/honeycrisp/.claude/worktrees/agent-aa1259cb10112b22a/aruminium/src/render/tests.rs
cyb/honeycrisp/.claude/worktrees/agent-ad6c77c38e86bc291/aruminium/src/render/tests.rs

Graph