Skip to content

Tests fail on Windows #106

Closed
oravecz opened this Issue Nov 22, 2010 · 7 comments

3 participants

@oravecz
oravecz commented Nov 22, 2010

The path separator is not taken into consideration on Windows, so nine tests fail because of this. Also, there is one test which performs a file size check, but on Windows the file is larger because an EOL character is CR/LF on windows.

I've addressed these issues in a patch I will attach (once I figure out how to do so with git). I added a function to files.js which simply replaces backslashes with forward slashes for test assertion use. Files.js may not be the best place for this, so it should be moved to a test-only scoped module. I would of made it a special type of assertion, but that seemed to heavy handed.

There is one test that still fails because I am unsure how to address it.

exports.testResolveId = function () {
    // Child must start w/ ".".
    assert.strictEqual(
        files.normalizePathSeparator(fs.resolve(PARENT, VALID_CHILD)),
        files.normalizePathSeparator(files.resolveId(PARENT, VALID_CHILD))
    ); 
}

Results in Expected "/home/ringo/Projects", got "home/ringo/Projects"

@oravecz
oravecz commented Nov 22, 2010

Here is a gist of the patch:
https://gist.github.com/709432

@hns
RingoJS member
hns commented Nov 22, 2010

Thanks for taking the initiative! I'm not convinced about the normalizePathSeparator approach, though. I think I'd prefer the tests to have better ideas of what to expect a file path or file size to be, maybe by directly using "native" java APIs, and comparing that to the outcome from Ringo modules. What do you think?

@hns
RingoJS member
hns commented Nov 22, 2010

I fixed most windows test failures without adding new functionality. In some cases the tests made wrong assumptions, and I think I also resolved a bug in fs.resolve() on Windows where \foo was not recognized as absolute path.

The remaining 3 failures are due to the weird implementation of ZipResource.getPath(). I have a branch in my github repo that would fix this, but I haven't decided yet which way to go here.

@botic
RingoJS member
botic commented Feb 16, 2011

This is an additional bug regarding Windows path separators & failing tests:
https://groups.google.com/d/msg/ringojs/28pGpwa18YY/1FD6YEVsCrAJ

@oravecz
oravecz commented Aug 6, 2011

Four tests continue to fail on master/HEAD.

It seems in Windows that the path separator inside an archive file does not necessarily match the path separator of the operating system.

[java]      + Running testGetResource ... FAILED
[java]    Expected "D:\Projects\ThirdParty\ringojs\test\repository\data.zip\test.txt", got "D:\Projects\ThirdParty\ringojs\test\repository\data.zip/test.txt"

Also on Windows, the CR/LF is two bytes where on other OS they are one byte.

 [java]      + Running testGetNestedResource ... FAILED
 [java]    Expected 2240, got 2274

I don't think there is a problem in the underlying source, but rather just the test need to reflect the reality of the situation.

@oravecz
oravecz commented Aug 6, 2011

Issued pull request to resolve the problem.

@oravecz oravecz closed this Aug 6, 2011
@oravecz oravecz reopened this Aug 6, 2011
@botic botic added the wontfix label Nov 17, 2015
@botic
RingoJS member
botic commented Nov 17, 2015

I close this issue due its age and the tests are all green now.

@botic botic closed this Nov 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.