[PATCH V2] test-paths.t: enable for Windows

Mads Kiilerich mads at kiilerich.com
Sun Jun 3 13:30:32 UTC 2012


Adrian Buehlmann wrote, On 06/03/2012 11:26 AM:
> # HG changeset patch
> # User Adrian Buehlmann<adrian at cadifra.com>
> # Date 1338714288 -7200
> # Node ID 34a701cb76f076cc94993f08e4d3d724a5515875
> # Parent  7b460b49bf7b75c5a4ab444915c52802c9f97f33
> test-paths.t: enable for Windows
>
> If the no-msys exit at the beginning is removed, the test fails on Windows with
> MSYS with:
>
>    --- C:\Users\adi\hgrepos\hg-main\tests\test-paths.t
>    +++ C:\Users\adi\hgrepos\hg-main\tests\test-paths.t.err
>    @@ -24,7 +24,7 @@
>       expand = $TESTTMP/a/foo/bar (glob)
>       $ SOMETHING=/foo hg paths
>       dupe = $TESTTMP/b (glob)
>    -  expand = /foo/bar
>    +  expand = c:/MinGW/msys/1.0/foo/bar
>       $ hg paths -q
>       dupe
>       expand
>
> diff --git a/tests/test-paths.t b/tests/test-paths.t
> --- a/tests/test-paths.t
> +++ b/tests/test-paths.t
> @@ -1,5 +1,3 @@
> -  $ "$TESTDIR/hghave" no-msys || exit 80 # MSYS will translate /foo/bar as if it was a real file path
> -
>     $ hg init a
>     $ hg clone a b
>     updating to branch default
> @@ -24,7 +22,11 @@
>     $ SOMETHING=foo hg paths
>     dupe = $TESTTMP/b (glob)
>     expand = $TESTTMP/a/foo/bar (glob)
> -  $ SOMETHING=/foo hg paths
> +  $ if "$TESTDIR/hghave" -q msys; then
> +>    SOMETHING=//foo hg paths
> +>  else
> +>    SOMETHING=/foo hg paths
> +>  fi

Bike-shedding a bit here to try to establish best practice in this area:

I think we would like to get away from this use of hghave.

Something like this is a bit more verbose and with some redundancy but might be more readable:

#if msys
   $ SOMETHING=//foo hg paths
   dupe = $TESTTMP/b (glob)
   expand = /foo/bar
#else
   $ SOMETHING=/foo hg paths
   dupe = $TESTTMP/b (glob)
   expand = /foo/bar
#endif


or without the redundancy but a bit more verbose:

#if msys
   $ SOMETHING=//foo
#else
   $ SOMETHING=/foo
#endif
   $ export SOMETHING
   $ hg paths
   dupe = $TESTTMP/b (glob)
   expand = /foo/bar

or perhaps something like (untested):

#if msys msys
   $ SLASH=///
#else
   $ SLASH=/
#endif

...

  $ SOMETHING=${SLASH}foo hg paths
  dupe = $TESTTMP/b (glob)
  expand = /foo/bar

where the test suite perhaps could export MSYSSAFESLASH.


The simple solution is of course to just skip this single test, but it would be nice to have full test coverage on windows here since url slashes easily can be handled incorrectly on windows by using fs path manipulation.

/Mads




More information about the Mercurial-devel mailing list