Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix line linking for Bash (in English) #494

Merged
merged 2 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tested/languages/bash/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def cleanup_stacktrace(self, stacktrace: str) -> str:
f"{EXECUTION_PREFIX}_[0-9]+_[0-9]+\\."
f"{self.file_extension()}: [a-zA-Z_]+ [0-9]+:"
)
script = rf"{submission_file(self)}: (regel|rule) (\d+)"
script = rf"{submission_file(self)}: (regel|line|rule) (\d+)"
stacktrace = re.sub(script, r"<code>:\2", stacktrace)
stacktrace = regex.sub("<testcode>:", stacktrace).replace(
submission_file(self), "<code>"
Expand Down
20 changes: 17 additions & 3 deletions tests/test_stacktrace_cleaners.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
_convert_stacktrace_to_html,
_replace_code_line_number,
)
from tested.testsuite import Suite
from tested.testsuite import Suite, SupportedLanguage


def get_language(workdir: str, language: str) -> Language:
Expand All @@ -20,7 +20,7 @@ def get_language(workdir: str, language: str) -> Language:
time_limit=0,
memory_limit=0,
natural_language="nl",
programming_language=language,
programming_language=SupportedLanguage(language),
workdir=Path(workdir),
judge=Path(),
)
Expand Down Expand Up @@ -210,7 +210,7 @@ def test_bash_runtime_error():
assert actual == expected


def test_bash_compilation_error():
def test_bash_compilation_error_nl():
original = """
submission: rule 1: syntaxfout nabij onverwacht symbool '('
submission: rule 1: `def isISBN10(code):'
Expand All @@ -224,6 +224,20 @@ def test_bash_compilation_error():
assert actual == expected


def test_bash_compilation_error_en():
original = """
submission: line 1: syntaxfout nabij onverwacht symbool '('
submission: line 1: `def isISBN10(code):'
"""
language_config = get_language("test", "bash")
expected = """
<code>:1: syntaxfout nabij onverwacht symbool '('
<code>:1: `def isISBN10(code):'
"""
actual = language_config.cleanup_stacktrace(original)
assert actual == expected


def test_c_compilation_error():
original = """In file included from execution_0_0.c:6,
from selector.c:6:
Expand Down
Loading