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

diff library eats last line if final newline is missing #412

Closed
pdawyndt opened this issue Aug 1, 2019 · 1 comment
Closed

diff library eats last line if final newline is missing #412

pdawyndt opened this issue Aug 1, 2019 · 1 comment
Labels
bug Something isn't working migrated Issues migrated from our previous GitHub enterprise repository
Milestone

Comments

@pdawyndt
Copy link
Contributor

pdawyndt commented Aug 1, 2019

Seemingly, the diff library used by Dodona eats the last line of a test expected/generated pair if the final newline is missing in at least one of the two.

Example: submission 821685 (second testcase with expected/generated return value should have three lines, not two.

This is how the JSON for the test in this testcase looks like, when I locally run the submission.

"tests": [
    {
        "status": "wrong answer",
        "accepted": false,
        "expected": "1: 0\n2: 3\n3: 0",
        "data": {
            "channel": "return"
        },
        "generated": "1: 0\n2: 3\n3: 0\n",
        "messages": [
            {
                "description": "Error: returned string has spurious trailing newline",
                "format": "code"
            }
        ],
        "description": {
            "description": "<span class=\"label label-danger\" style=\"display: block;text-align:left;\">return</span>",
            "format": "html"
        }
    }
],

Original issue by @pdawyndt on Wed May 03 2017 at 16:21.
Closed by @charvp on Fri Nov 09 2018 at 08:09.

@chvp chvp mentioned this issue Aug 1, 2019
@ninewise
Copy link

ninewise commented Aug 1, 2019

It does indeed. I've created an issue with the gem.

> puts Diffy::Diff.new("1\n2", "1\n2\n").to_s
 1
-2
\ No newline at end of file
+2
 => nil
> puts Diffy::Diff.new("1\n2", "1\n2\n").to_s(:html)
<div class="diff">
  <ul>
    <li class="unchanged"><span>1</span></li>
  </ul>
</div>
 => nil

Original comment by @ninewise on Wed May 03 2017 at 16:52.

@dodona-server dodona-server added bug Something isn't working migrated Issues migrated from our previous GitHub enterprise repository WIP labels Aug 1, 2019
@chvp chvp closed this as completed Aug 1, 2019
@dodona-server dodona-server added this to the 2.6 milestone Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working migrated Issues migrated from our previous GitHub enterprise repository
Projects
None yet
Development

No branches or pull requests

4 participants