test_guard_substrate.py

tests/guard/test_guard_substrate.py

The gate's extension -> language table comes from lang-parsing-substrate.

test_languages_without_a_spec_are_not_mapped

test_guard_substrate.test_languages_without_a_spec_are_not_mapped()

Go is in the substrate but the gate has no LanguageSpec for it.

tests/guard/test_guard_substrate.py:24

Checks

  • assert ".go" not in EXTENSION_TO_LANGUAGE
  • assert language_for_file("main.go", {}) is None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-020measuredtest_languages_without_a_spec_are_not_mapped → language_for_file
Source · 6 lines
def test_languages_without_a_spec_are_not_mapped():
    """Go is in the substrate but the gate has no LanguageSpec for it."""
    assert ".go" not in EXTENSION_TO_LANGUAGE
    assert language_for_file("main.go", {}) is None

Activity · 2 steps
lines 26–26assert ".go" not in EXTENSION_TO_LANGUAGElines 27–27assert language_for_file("main.go", {}) is None

test_tsx_is_routed_to_the_jsx_aware_grammar

test_guard_substrate.test_tsx_is_routed_to_the_jsx_aware_grammar()

The substrate files `.tsx` under typescript; the gate parses it with the tsx grammar.

tests/guard/test_guard_substrate.py:30

Checks

  • assert EXTENSION_TO_LANGUAGE[".tsx"] == "typescript"
  • assert language_for_file("App.tsx", {}) == "tsx"
  • assert language_for_file("app.ts", {}) == "typescript"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-020measuredtest_tsx_is_routed_to_the_jsx_aware_grammar → language_for_file
Source · 7 lines
def test_tsx_is_routed_to_the_jsx_aware_grammar():
    """The substrate files `.tsx` under typescript; the gate parses it with the tsx grammar."""
    assert EXTENSION_TO_LANGUAGE[".tsx"] == "typescript"
    assert language_for_file("App.tsx", {}) == "tsx"
    assert language_for_file("app.ts", {}) == "typescript"

Activity · 3 steps
lines 32–32assert EXTENSION_TO_LANGUAGE[".tsx"] == "typescript"lines 33–33assert language_for_file("App.tsx", {}) == "tsx"lines 34–34assert language_for_file("app.ts", {}) == "typescript"