mustache.java icon indicating copy to clipboard operation
mustache.java copied to clipboard

Unit tests fail on Windows OS

Open vbauer opened this issue 10 years ago • 7 comments

vbauer avatar Mar 31 '15 22:03 vbauer

+1

xvik avatar Apr 05 '15 20:04 xvik

Unit tests are working for me on windows 7 pro, Oracle JDK8

DALDEI avatar Apr 06 '15 19:04 DALDEI

@DALDEI Strange. Are you sure that you run all of them? I'm using Windows 7 Ultimate (SP1) + Oracle JDK 8.

Example 1:

    at junit.framework.Assert.assertEquals(Assert.java:100)
    at junit.framework.Assert.assertEquals(Assert.java:107)
    at com.github.mustachejava.PreTranslateTest.testPretranslate(PreTranslateTest.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)

Example 2:

testDeferred(com.github.mustachejava.InterpreterTest)  Time elapsed: 0.008 sec  <<< FAILURE!
junit.framework.ComparisonFailure: expected:<...TML="I am calculated[\n\"later\" and divs\nare written out &lt;]\nnow";</script>
]\nnow";</script>
</...>
    at junit.framework.Assert.assertEquals(Assert.java:100)
    at junit.framework.Assert.assertEquals(Assert.java:107)
    at junit.framework.TestCase.assertEquals(TestCase.java:269)
    at com.github.mustachejava.InterpreterTest.testDeferred(InterpreterTest.java:760)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)

Example 3:

    at junit.framework.Assert.assertEquals(Assert.java:100)
    at junit.framework.Assert.assertEquals(Assert.java:107)
    at junit.framework.TestCase.assertEquals(TestCase.java:269)
    at com.github.mustachejava.InterpreterTest.testNestedLatches(InterpreterTest.java:405)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at junit.framework.TestCase.runTest(TestCase.java:176)
    at junit.framework.TestCase.runBare(TestCase.java:141)

Example 4:

</partial> Test>
    at junit.framework.Assert.assertEquals(Assert.java:100)
    at junit.framework.Assert.assertEquals(Assert.java:107)
    at junit.framework.TestCase.assertEquals(TestCase.java:269)
    at com.github.mustachejava.InterpreterTest.testSimpleFiltered(InterpreterTest.java:168)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at junit.framework.TestCase.runTest(TestCase.java:176)

Most of them failed because of incorrect line ending (\n instead of \r\n).

vbauer avatar Apr 06 '15 20:04 vbauer

Line ending issues are locally configurable by git settings. I suspect mine are set correctly (I do a lot of windows development from git sources by linux developers).

Try this out and see if it helps https://help.github.com/articles/dealing-with-line-endings/

DALDEI avatar Apr 07 '15 00:04 DALDEI

I know how to configure line endings for Git. :) However, don't you think that it is a bug, when template engine produces wrong line endings?

UPD: Sorry, I formulated it wrong. Isn't it a bug when tests depend on the Git environment?

vbauer avatar Apr 07 '15 07:04 vbauer

EOL management is an inherited hell that the best have been unble to solve to everyone's liking, Bump it up a level and try to get Unicode uncorrupted end to end through an app and you'll find very few programmers capable of even understanding what's going on. ... I'll l live with EOL issues in test cases

I bitched when Cygwin stopped accepting CRLF in she'll scripts, I still am annoyed at my own OSS tests that fail on base64 or literal escapes when run on different platforms or transformed by SCM. It's annoying , yes, but "fixing " it is difficult work oft better applied to other tasks.

This is compounded by JUnit test methodology Strongly favoring java string liberals as the result ( no generic EOL escape sequence) but using a tool that reads from the filesystem ... ( outside factors changing EOL at will). Often any atte,pt to reconcile will fail half the time or succeed when it shouldn't,

If it's as simple as setring git or running dos2unix ... Considering the tests are quite large AND inherently unrealistic ( JUint methodology ... E.g not application end to end tests ) I'm happy rpthere are tests at all.

For OSS code , i get more then I'm paying for. ... And I suspect a volunteer to improve or would be welcome ...

DALDEI avatar Apr 08 '15 02:04 DALDEI

I'd love to understand what I should be doing for Windows to work perfectly.

spullara avatar May 27 '16 23:05 spullara