rsingla / jslint4java

Automatically exported from code.google.com/p/jslint4java
Other
0 stars 0 forks source link

Platform dependent issues when compiling on windows 7 #58

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I encountered two test-case errors when trying to build jslint4java on a 
swedish windows 7 system.

jslint4java:

googlecode.jslint4java.formatter.JUnitXmlFormatterTest 
This test case expects the time attribute results in US decimal format (i.e. 
0.000 instead of 0,000).

If this is expected, one fix is to edit JUnitXmlFormatter.formatTimeAsSeconds 
as following: 

 private String formatTimeAsSeconds(long duration) {
        return String.format(java.util.Locale.US, "%.3f", duration / 1000.0);
 }

jslint4java-ant:

The PlainResultFormatterTest.testExpectedOutputOneIssue() has a comment that 
looks like the following:

// NB: We use platform encoding here, as that's what we expect the
// formatter to produce.

It uses the System.getProperty("line.separator") which resolves to \r\n on 
windows.

However the PlainFormatter in jslint4java and its following test 
PlainFormatterTest uses hardcoded \n's 

I am not sure about this one, but I changed the PlainFormatterTest to use "\n" 
as separator and all tests now passed after this.

Original issue reported on code.google.com by jo...@weightpoint.se on 13 Jun 2011 at 4:56

GoogleCodeExporter commented 9 years ago
Thanks for reporting this.  I don't have access to a windows system to test on, 
so this is very helpful.

I've patched formatTimeAsSeconds() as indicated.

With the newlines, I'm using println(), which I thought should output \r\n on a 
windows system.  I'm kinda confused about when and where this should or 
shouldn't be happening.  I'll take a peek…

Original comment by d...@happygiraffe.net on 13 Jun 2011 at 5:40

GoogleCodeExporter commented 9 years ago
Thanks!

In com.googlecode.jslint4java.formatter.JUnitXmlFormatter \n's are inserted 
instead of using System.getProperty("line.separator").

Same goes with the JUnitXmlFormatterTest which tests for \n.

Original comment by jo...@weightpoint.se on 13 Jun 2011 at 5:43

GoogleCodeExporter commented 9 years ago
The JUnitXmlFormatter actually doesn't matter, as it's XML, and being parsed by 
an XML parser before it gets tested.  But I've switched the output as it'll 
make it simpler on Windows to read with notepad. :)

Original comment by d...@happygiraffe.net on 13 Jun 2011 at 7:45

GoogleCodeExporter commented 9 years ago
Fixed in 4867bee04bc3bc73c98497537eac76d0d641a498.

Original comment by d...@happygiraffe.net on 13 Jun 2011 at 9:27

GoogleCodeExporter commented 9 years ago

Original comment by d...@happygiraffe.net on 14 Jul 2011 at 8:06