Skip to content

Commit 4e6a8ca

Browse files
committed
Add a couple more tests to check for uppercase variable names and alter regex to improve reporting of varriable name causing error.
1 parent fe10e71 commit 4e6a8ca

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

script_umdp3_checker/tests/test_fortran_checks.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,17 @@ def test_write_using_default_format(lines, expected_result):
180180
1,
181181
"Uppercase variable name with leading whitespace",
182182
),
183-
]
183+
(
184+
["REAL :: var1", "REAL :: VAR2", "REAL :: Var3"],
185+
1,
186+
"Mixed case variable names",
187+
),
188+
(
189+
["REAL :: var1, DAVE_2, HiPPo", "REAL :: var2", "REAL :: var3"],
190+
1,
191+
"2nd variable all uppercase",
192+
),
193+
]
184194

185195

186196
@pytest.mark.parametrize(

script_umdp3_checker/umdp3_checker_rules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def lowercase_variable_names(self, lines: List[str]) -> TestResult:
338338
"",
339339
clean_line,
340340
)
341-
if match := re.search(r"([A-Z]{2,})", clean_line):
341+
if match := re.search(r"([A-Z]{2,}\w*)", clean_line):
342342
self.add_extra_error(f"UPPERCASE variable name : {match[1]}")
343343
failures += 1
344344
error_log = self.add_error_log(

0 commit comments

Comments
 (0)