Adafruit_CircuitPython_PIOASM/tests/test_misc.py
Jeff Epler be66c02eb3 Better diagnose the incorrect lines like "side 1" or "[5]"
Before this, the exception would be 'IndexError: list index out of range'.
Now it is 'Unknown instruction: side' or similar.

(These need an instruction, even if it's a `nop`: `nop side 1 [5]`)
2024-07-10 08:09:46 -05:00

39 lines
825 B
Python

# SPDX-FileCopyrightText: KB Sriram
#
# SPDX-License-Identifier: MIT
"""
Tests out
"""
from pytest_helpers import assert_assembly_fails
def test_invalid_sideset() -> None:
source = [
".side_set 2",
"side 2 [5]",
]
assert_assembly_fails(
"\n".join(source), match="Unknown instruction: side", errtype=RuntimeError
)
source = [
".side_set 2",
"side 2",
]
assert_assembly_fails(
"\n".join(source), match="Unknown instruction: side", errtype=RuntimeError
)
def test_invalid_delay() -> None:
assert_assembly_fails(
"[5]", match=r"Unknown instruction: \[5\]", errtype=RuntimeError
)
def test_invalid_instruction() -> None:
assert_assembly_fails(
"bad", match=r"Unknown instruction: bad", errtype=RuntimeError
)