Description
Ref Patch: https://issues.apache.org/jira/secure/attachment/12552008/PIG-3027.trunk.1.patch
With the above patch fix:
readFile(expected).replaceAll("\r\n", "\n") gives the expected file contents as (note: the exp file does not contain a "\n" after the last line of text):
~~~~~~~~~~~~~~~~~~~~
(yahoo,25)
(facebook,15)
(twitter,7)
12/11/28 02:59:06 INFO pigunit.PigTest:..............
~~~~~~~~~~~~~~~~~~~~
And the test case fails with:
~~~~~~~~~~~~~~~~~~~~
junit.framework.ComparisonFailure: expected:<...book,15)
(twitter,7)[
]> but was:<...book,15)
(twitter,7)[]>
at junit.framework.Assert.assertEquals(Assert.java:85)
at junit.framework.Assert.assertEquals(Assert.java:91)
~~~~~~~~~~~~~~~~~~~~
After adding trim to the above patch:
readFile(expected).replaceAll("\r\n", "\n").trim() gives the expected file contents as:
~~~~~~~~~~~~~~~~~~~~
(yahoo,25)
(facebook,15)
(twitter,7)
12/11/28 03:10:06 INFO pigunit.PigTest:..............
~~~~~~~~~~~~~~~~~~~~
And the above test case passed.
Please review if trim should be added to avoid the additional newline at the end of expected string.
Pls note: I was running the tests in rhel environment.
Thank you.