You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Antoine Lévy-Lambert <an...@antbuild.com> on 2003/09/23 12:23:27 UTC

ReplaceTest failing under cygwin

ReplaceTest fails under cygwin.
    [junit] Testcase: test9 took 0,13 sec
     [junit] 	FAILED     [junit] expected:<10> but was:<13>
     [junit] junit.framework.AssertionFailedError: expected:<10> but
was:<13>

This has to do with the fact that the Replace task changes the line endings
of tokens and values to System.getProperty("line.separator"), but that the
files used for the tests are terminated with \n only when one uses the
cvs.exe of cygwin.

I can think of several ways of fixing this :

- the easiest would be to change the Replace task, not to touch the line
endings of tokens and values at all. After all, I do not know why they get
such a special treatment. But this would also be a backward incompatible
change,

- adding an enumerated attribute eol (like in the fixcrlf task) to the
nested elements <replacetoken/>, <replacevalue/>, <replacefilter/>. Like in
the fixcrlf task, the platform's line separator would be the default there,
and "asis" would be used to run the test(s) with predictable results.

Is the reason why line endings of tokens and values in <replace/> are
manipulated that, when they are read from <!<[CDATA[, the xml parser sends
to ant \n as line separator also on Windows, which is generally not what is
desired ? When on the contrary the replacetoken or replacevalue come from a
property, the build file writer is fully in control of the flavour of the
line endings of the tokens and values and would not need any special
manipulation.

Cheers,

Antoine


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: ReplaceTest failing under cygwin

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Antoine Lévy-Lambert wrote:
> of tokens and values to System.getProperty("line.separator"), but that the
> files used for the tests are terminated with \n only when one uses the
> cvs.exe of cygwin.
And if the CygWin is installed using Unix line endings (the default).
Is there anybody out there who checked "Use DOS line endings" for
CygWin?

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: ReplaceTest failing under cygwin

Posted by peter reilly <pe...@corvil.com>.
On Tuesday 23 September 2003 11:23, Antoine Lévy-Lambert wrote:
> ReplaceTest fails under cygwin.
>     [junit] Testcase: test9 took 0,13 sec
>      [junit] 	FAILED     [junit] expected:<10> but was:<13>
>      [junit] junit.framework.AssertionFailedError: expected:<10> but
> was:<13>
>
> This has to do with the fact that the Replace task changes the line endings
> of tokens and values to System.getProperty("line.separator"), but that the
> files used for the tests are terminated with \n only when one uses the
> cvs.exe of cygwin.
>
> I can think of several ways of fixing this :
>
> - the easiest would be to change the Replace task, not to touch the line
> endings of tokens and values at all. After all, I do not know why they get
> such a special treatment. But this would also be a backward incompatible
> change,
>
> - adding an enumerated attribute eol (like in the fixcrlf task) to the
> nested elements <replacetoken/>, <replacevalue/>, <replacefilter/>. Like in
> the fixcrlf task, the platform's line separator would be the default there,
> and "asis" would be used to run the test(s) with predictable results.

- Change the test... or declare the failure invalid.
  The test checks line ending without having control of the lineendings as
  on windows, the cvs client may or may not add <cr>'s to files. For text
  files it should, but cygwin's cvs client does not do this. A simple
  fix is to use a cvs client that respects crazy windows/dos behaviour
  (cvsnt is the one I used when I was on NT).

  The test could write the expected result instead of using expected files
  in cvs.

Peter
>
> Is the reason why line endings of tokens and values in <replace/> are
> manipulated that, when they are read from <!<[CDATA[, the xml parser sends
> to ant \n as line separator also on Windows, which is generally not what is
> desired ? When on the contrary the replacetoken or replacevalue come from a
> property, the build file writer is fully in control of the flavour of the
> line endings of the tokens and values and would not need any special
> manipulation.
>
> Cheers,
>
> Antoine
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org