Skip to content

Commit 68d2730

Browse files
committed
fix: fix testing issues
1 parent e838e53 commit 68d2730

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

python/test_grammar.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66

77
TEST_MODELS_DIR = os.path.join(os.path.dirname(__file__), "..", "test_models")
88

9+
# Files that are misplaced in test_models/ but actually test invalid syntax
10+
# (dotinfeaturename.uvl has comment "should be illegal" - dots not allowed in quoted IDs)
11+
MISPLACED_INVALID_FILES = {
12+
"lexing/dotinfeaturename.uvl",
13+
}
14+
915
# Semantic errors that the parser cannot detect (only syntax errors are caught)
1016
SEMANTIC_ERROR_FILES = {
1117
"missingreference.uvl",
@@ -14,9 +20,14 @@
1420
}
1521

1622

23+
def relative_path(file):
24+
return os.path.relpath(file, TEST_MODELS_DIR)
25+
26+
1727
def get_valid_files():
1828
all_files = glob.glob(os.path.join(TEST_MODELS_DIR, "**", "*.uvl"), recursive=True)
19-
return [f for f in all_files if os.sep + "faulty" + os.sep not in f]
29+
valid = [f for f in all_files if os.sep + "faulty" + os.sep not in f]
30+
return [f for f in valid if relative_path(f) not in MISPLACED_INVALID_FILES]
2031

2132

2233
def get_faulty_syntax_files():
@@ -25,10 +36,6 @@ def get_faulty_syntax_files():
2536
return [f for f in all_faulty if os.path.basename(f) not in SEMANTIC_ERROR_FILES]
2637

2738

28-
def relative_path(file):
29-
return os.path.relpath(file, TEST_MODELS_DIR)
30-
31-
3239
@pytest.mark.parametrize("uvl_file", get_valid_files(), ids=relative_path)
3340
def test_valid_model(uvl_file):
3441
tree = get_tree(uvl_file)

python/uvl/UVLCustomLexer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def handleNewline(self):
7676
next_code = self._input.LA(1)
7777
next_char = chr(next_code) if next_code != -1 else ''
7878

79-
if self.opened > 0 or next_char == '\r' or next_char == '\n' or next_char == '\f' or next_char == '#':
79+
if self.opened > 0 or next_char in '\r\n\f' or next_char == '/' or next_char == '#':
8080
self.skip()
8181
else:
8282
self.emitToken(self.common_token(self.NEWLINE, new_line))

0 commit comments

Comments
 (0)