Raghavendra Saravanamurthy created PIG-3070:
-----------------------------------------------

             Summary: PigTest - Patch for PIG-3027 - Pls review to see if trim 
required after replacing all "\r\n" with "\n" to avoid additional newline at 
end of expected string. 
                 Key: PIG-3070
                 URL: https://issues.apache.org/jira/browse/PIG-3070
             Project: Pig
          Issue Type: Bug
          Components: build
    Affects Versions: 0.10.0
            Reporter: Raghavendra Saravanamurthy
            Priority: Minor
             Fix For: 0.10.1


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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to