tabula-java icon indicating copy to clipboard operation
tabula-java copied to clipboard

Use platform lineSeparator to join TextChunks

Open slachiewicz opened this issue 6 years ago • 1 comments

Running tests on windows generates an error caused by using \r to merge text in TextChunks.

Switch to System.lineSeparator() to fix tests.

slachiewicz avatar Sep 11 '17 14:09 slachiewicz

I found this issue because I am having a similar problem. Just changing the within-cell line separator doesn't seem to fix it for me though. That seems to just change the test failures. E.g. making the change in Cell in the linked PR causes new failures for me like:

testExtractSpreadsheetWithArea(technology.tabula.TestCommandLineApp)  Time elapsed: 0.047 s  <<< FAILURE!
org.junit.ComparisonFailure:
expected:<...ATION,,,
"","11/12^M[(a)",12/13,Percentage,Absolute,
"","May/2013^M(b)","Jun/2013^M](c)",(c/a),(c-a),
C...> but was:<...ATION,,,
"","11/12^M[
(a)",12/13,Percentage,Absolute,
"","May/2013
(b)","Jun/2013
](c)",(c/a),(c-a),
C...>
        at technology.tabula.TestCommandLineApp.testExtractSpreadsheetWithArea(TestCommandLineApp.java:37)

Without that change (i.e. at current "head" adb7738c87) the test failure I get is:

Test set: technology.tabula.TestCommandLineApp
-------------------------------------------------------------------------------
Tests run: 13, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.918 s <<< FAILURE! - in technology.tabula.TestCommandLineApp
testLatticeModeWithColumnOption(technology.tabula.TestCommandLineApp)  Time elapsed: 0.013 s  <<< FAILURE!
org.junit.ComparisonFailure:
expected:<...phecomyiastratiosph^M[
ecomyioides",Says,bzzzzzzz
Fox,Says,"Ring-
dingdingdingdingeringedingGer
ing-
dingdingdingdingeringedingGer
]ing-dingdingdingding...> but was:<...phecomyiastratiosph^M[ecomyioides",Says,bzzzzzzz
Fox,Says,"Ring-^MdingdingdingdingeringedingGer^Ming-^MdingdingdingdingeringedingGer^M]ing-dingdingdingding...>
        at technology.tabula.TestCommandLineApp.testLatticeModeWithColumnOption(TestCommandLineApp.java:198)

I wonder if there might be something going on with the encoding of the test csv files when checked out under git on Windows?

gamorris avatar Nov 28 '21 16:11 gamorris