-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]`)
- Loading branch information
Showing
2 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# 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 | ||
) |