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

Allow CRLF #703

Merged
merged 8 commits into from
Mar 18, 2020
Merged
Changes from 3 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
15 changes: 15 additions & 0 deletions onlinejudge/_implementation/command/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@ def match(a, b):
if rstrip and a.rstrip(rstrip_targets) == b.rstrip(rstrip_targets):
log.warning('WA if no rstrip')
return True
if a == b.replace('\n', '\r\n'):
log.warning(r'WA if not replaceing "\r\n" with "\n"')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: replacingです。全体的に。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直した

return True
if rstrip and a.rstrip(rstrip_targets) == b.replace('\n', '\r\n').rstrip(rstrip_targets):
log.warning('WA if no rstrip')
log.warning(r'WA if not replaceing "\r\n" with "\n"')
return True
if a.replace('\n', '\r\n') == b:
log.warning(r'WA if not replaceing "\n" with "\r\n"')
return True
if rstrip and a.replace('\n', '\r\n').rstrip(rstrip_targets) == b.rstrip(rstrip_targets):
# TODO: use a smart way if you need more equality patterns
log.warning('WA if no rstrip')
log.warning(r'WA if not replaceing "\n" with "\r\n"')
return True
return False

# prepare the function to print the input
Expand Down