Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Fixing the LF issue #410

Closed
18 tasks done
kazk opened this issue May 4, 2017 · 8 comments
Closed
18 tasks done

Fixing the LF issue #410

kazk opened this issue May 4, 2017 · 8 comments

Comments

@kazk
Copy link
Member

kazk commented May 4, 2017

Fixing the issue where users' output affects the test result.

user logged output<FAILED::>

  • Rust (lib/runners/rust.js) outputs the result differently from the most and not really affected.
    • stdout is transformed after the test and only contains the output commands
      <DESCRIBE::>returns_expected
      <FAILED::>Test Failed
      
    • stderr contains the details on failure (print!("foo"); assert_eq!(1, 2);)
      Failure Info:
      
      ---- returns_expected stdout ----
      	foothread 'returns_expected' panicked at 'assertion failed: `(left == right)` (left: `1`, right: `2`)', main.rs:17
      

codewars/codewars.com#867
codewars/codewars.com#937

@kazk
Copy link
Member Author

kazk commented May 4, 2017

C# example from @Voileexperiments's comment

using System;
using NUnit.Framework;

[TestFixture]
public class KataTestClass
{
    [Test]
    public void Test()
    {
        Console.Write("foobar");
        Assert.AreEqual(true, false);
    }
}

Outputs

foobar<FAILED::>  Expected: True
  But was:  False

image

@Voileexperiments
Copy link

JS example:

Test.expect(true);
process.stdout.write('foobar');
Test.expect(false);
process.stdout.write('foobar\n');
Test.expect(false);
process.stdout.write('foobar');
Test.expect(false);

Python example:

#Python 2
import sys

test.expect(True)
sys.stdout.write('foo')
test.expect(False;
sys.stdout.write('bar')
test.expect(True)

#Python 3
test.expect(True)
print('foo', end='')
test.expect(False)
print('bar', end='')
test.expect(True)

image

@Voileexperiments
Copy link

Throwing out some ideas:

Is it possible for the runner to detect current stdout? If so, it can then just check if the last character is a line feed, and if not, send one to stdout first.

Or alternatively, send a extra linefeed before the test messages no matter what. This will increases the character count by a bit and doubles the number of lines, but it might totally avert the issue?

@kazk
Copy link
Member Author

kazk commented May 4, 2017

Extra line feed will be added (like in bb41dbb).
See @jhoffner's comment in codewars/codewars.com#867.

This was referenced May 4, 2017
kazk added a commit to kazk/codewars-runner-cli that referenced this issue May 4, 2017
This was referenced May 4, 2017
@kazk
Copy link
Member Author

kazk commented May 4, 2017

Causes server execution error in Dart :(

image

@kazk
Copy link
Member Author

kazk commented May 5, 2017

@jhoffner can we move Codewars/mocha-reporter in this repository by updating Mocha?
Mocha v3.3.0 "Adds support for loading reporter from an absolute or relative path" and supports node >= 0.10.x.

@jhoffner
Copy link
Member

jhoffner commented May 5, 2017

Sure let's do it.

@kazk kazk mentioned this issue May 5, 2017
@kazk
Copy link
Member Author

kazk commented May 9, 2017

I found that JavaScript has been tested with mocha installed in base-image at docker/base.docker#L107 and not "mocha": "2.5.3" in package.json#L55.
I think the version has been 3.2.0 for while...

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

3 participants