Skip to content

Commit

Permalink
Merge pull request #501 from dodona-edu/enhance/newlines-again
Browse files Browse the repository at this point in the history
Do not add newlines to empty strings
  • Loading branch information
niknetniko authored Feb 21, 2024
2 parents 512311c + ebf84d8 commit 106446b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tested/dsl/translate_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ReturnOracle:


def _ensure_trailing_newline(text: str) -> str:
if not text.endswith("\n"):
if text and not text.endswith("\n"):
return text + "\n"
else:
return text
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dsl_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,4 +1099,4 @@ def test_empty_text_data_newlines():
json_str = translate_to_test_suite(yaml_str)
suite = parse_test_suite(json_str)
actual_stderr = suite.tabs[0].contexts[0].testcases[0].output.stderr.data
assert actual_stderr == "\n"
assert actual_stderr == ""

0 comments on commit 106446b

Please sign in to comment.