tests: conditionalize an error message about unlinking a non empty directory
authorMatt Harbison <matt_harbison@yahoo.com>
Fri, 07 Sep 2018 23:39:49 -0400
changeset 39478 c4a7ba10cdd7
parent 39477 8eb2145ff0fb
child 39479 3ba87d5b9ad3
tests: conditionalize an error message about unlinking a non empty directory The message on Windows comes from win32.unlink(). It looks like os.unlink() on posix platforms is a simple call to unlink(3), which turns into unlinkat(2). Since there's a comment in one of the tests that the message should be improved, I don't think it's worth adding a check in win32.unlink() to see if it's empty, if that function is always going to fail on a directory. (It seems like the POSIX spec allows unlinking directories though.)
tests/test-merge1.t
tests/test-update-names.t
--- a/tests/test-merge1.t	Fri Sep 07 14:48:38 2018 -0700
+++ b/tests/test-merge1.t	Fri Sep 07 23:39:49 2018 -0400
@@ -30,7 +30,8 @@
 
   $ mkdir b && touch b/nonempty
   $ hg up
-  abort: Directory not empty: '$TESTTMP/t/b'
+  abort: Unlinking directory not permitted: '$TESTTMP/t/b' (windows !)
+  abort: Directory not empty: '$TESTTMP/t/b' (no-windows !)
   [255]
   $ hg ci
   abort: last update was interrupted
--- a/tests/test-update-names.t	Fri Sep 07 14:48:38 2018 -0700
+++ b/tests/test-update-names.t	Fri Sep 07 23:39:49 2018 -0400
@@ -50,7 +50,8 @@
   $ hg st
   ? name/file
   $ hg up 1
-  abort: Directory not empty: '$TESTTMP/r1/r2/name'
+  abort: Unlinking directory not permitted: '$TESTTMP/r1/r2/name' (windows !)
+  abort: Directory not empty: '$TESTTMP/r1/r2/name' (no-windows !)
   [255]
   $ cat name/file
   text