editorconfig / editorconfig-core-test

Testings for EditorConfig Core
http://editorconfig.org
BSD 2-Clause "Simplified" License
28 stars 22 forks source link

10 tests fail on Windows #9

Open jednano opened 7 years ago

jednano commented 7 years ago

This is a long-standing issue (years) that continues to plague me when working on the editorconfig-core-js project. These tests run fine in the Travis-CI environment, but fail on Windows in my local dev environment.

@xuhdev do you know if there's something special about these particular tests that would make them fail on Windows, specifically? It makes it pretty difficult to do development when I have to wait for the CI environment to finish each run.

The following tests FAILED:
          9 - brackets_close_inside (Failed)
         11 - brackets_nclose_inside (Failed)
         55 - braces_escaped_comma1 (Failed)
         58 - braces_escaped_brace1 (Failed)
         59 - braces_escaped_brace2 (Failed)
         60 - braces_escaped_brace3 (Failed)
        146 - escaped_semicolon_in_section (Failed)
        153 - escaped_octothorpe_in_section (Failed)
        168 - windows_separator (Failed)
        169 - windows_separator2 (Failed)
xuhdev commented 7 years ago

For 168 and 169, I can sort of imagine incorrect handling of path separator. I guess the rest of the failed tests may also be affect by that.

jednano commented 7 years ago

If you can give me some tips to debug and test just one test at a time, I think I might be able to figure it out. Also, it's a bit hard for me to navigate these tests and find the appropriate one. I'm not at all familiar w/ ctest.

jednano commented 7 years ago

Is this where the two Windows tests are written?

jednano commented 7 years ago

Or is this where I should be looking?

xuhdev commented 7 years ago

@jedmao I think these should be what you are looking for...

jednano commented 7 years ago

These tests are pretty hard to read. I can't tell what the input/output is or what the expected value should be. Definitely not what I'm used to.

xuhdev commented 7 years ago

You should run ctest -VV --output-on-failure . to see output. And the definition of the test is in CMakeLists.txt.

jednano commented 7 years ago

Yeah. I knew that. I'm just expecting to see something like:

expect(foo('bar')).toEqual('baz');

Where it's very clear that foo is the function being tested, "bar" is the input and "baz" is the expected output.

I don't know how to translate what I'm seeing into that mindset.

jednano commented 7 years ago

For example:

new_ec_test(windows_separator path_separator.in windows/separator "^[ \t\n\r]*$")

How do I read that?

xuhdev commented 7 years ago
jednano commented 7 years ago

If I navigate to the filetree folder and run the following command:

editorconfig -f path_separator.in windows/separator

The output is:

key=value

Which I presume came from line 12. To me, this means the editorconfig command worked, even on Windows. I just don't see how the regex would match that output.

/^[ \t\n\r]*$/.test('key=value'); // false

Am I missing something? Or was it not supposed to hit line 12? Is there an assumption here that EditorConfig wouldn't actually work on Windows, but it is, which is throwing the test off?

xuhdev commented 7 years ago

@jedmao I can vaguely remember that we decided that all path separators in brackets must be /, even on Windows. @treyhunner Can you help confirm this?

jednano commented 7 years ago

I see, so it seems there actually is something wrong with the js core in that it shouldn't be accepting back slashes. That would make some sense.

The regex above is saying there should be no match, just white spaces, right?

xuhdev commented 7 years ago

Yes, that's correct.

jednano commented 7 years ago

@xuhdev, I think it would make sense to document our ini-like format in something that sounds more like English than these tests so we don't have similar confusions now or in the future.

jednano commented 7 years ago

I know for a fact that minimatch, the library that the js core has modified internally, accepts any variety of slashes, so that would do it.

xuhdev commented 7 years ago

OK, I fixed it in the doc: editorconfig/editorconfig.github.com@44b8cc1d390b72a4e9dcbfe7a1ae1f16e558573e

xuhdev commented 5 years ago

Is this issue still relevant today?

jednano commented 5 years ago

Yes. I think it warrants adding AppVeyor to the CI builds.

cxw42 commented 5 years ago

Example Appveyor config, in case it helps: https://github.com/cxw42/editorconfig-core-vimscript/blob/master/appveyor.yml

cxw42 commented 5 years ago

@jedmao If you have a chance, would you please test the JS core with the updates from #29? I would be interested to know if they help for JS, since they help the Vim and C cores pass on Windows.

jednano commented 5 years ago

Sure thing. I’ll try to find some time.

jednano commented 5 years ago

@cxw42 I put up a PR, but it breaks the build. I don't think the issue is with the new tests, however. I think there's actually a problem with the js core, which I was trying to fix a while back in this PR. Really, it's the INI parser that's the problem, from what I can tell. Perhaps we need something with more of a formal grammar.

cxw42 commented 5 years ago

Thanks for giving it a shot! If I get any ideas about the build failure, I'll let you know.