Newer
Older
navi-1 / mcp-servers / navi-3d / tests / unit / test_scad_analyze.py
"""Unit tests for scad_analyze module."""

from app.scad_analyze import _lint_scad_source


def test_lint_clean_source():
    source = "cube([10, 10, 10]);\n"
    errors, warnings = _lint_scad_source(source)
    assert not errors
    assert not warnings


def test_lint_undefined_identifier():
    source = "cube([foo, 10, 10]);\n"
    errors, warnings = _lint_scad_source(source)
    assert errors
    assert "Unknown identifier(s): foo" in errors[0]


def test_lint_noisy_source():
    source = "// Actually, let's fix this\ncube([10,10,10]);\n"
    errors, warnings = _lint_scad_source(source)
    assert errors
    assert "draft/self-correction language" in errors[0]


def test_lint_abandoned_module():
    source = "module unused() { cube([1,1,1]); }\n"
    errors, warnings = _lint_scad_source(source)
    assert not errors
    assert warnings
    assert "unused` is defined but never called" in warnings[0]