changeset 49033:9a5d09d7f108

crecord: add test demonstrating issue when reverting noeol->eol change Differential Revision: https://phab.mercurial-scm.org/D12440
author Kyle Lippincott <spectral@google.com>
date Tue, 05 Apr 2022 11:09:57 -0700
parents 3f6ef67e7a60
children 079197e94b24
files tests/test-revert-interactive-curses.t
diffstat 1 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-revert-interactive-curses.t	Mon Mar 28 10:43:10 2022 -0700
+++ b/tests/test-revert-interactive-curses.t	Tue Apr 05 11:09:57 2022 -0700
@@ -1,4 +1,5 @@
 #require curses
+#testcases committed wdir
 
 Revert interactive tests with the Curses interface
 
@@ -12,6 +13,22 @@
 
 TODO: Make a curses version of the other tests from test-revert-interactive.t.
 
+#if committed
+  $ maybe_commit() {
+  >   hg ci "$@"
+  > }
+  $ do_revert() {
+  >   hg revert -ir'.^'
+  > }
+#else
+  $ maybe_commit() {
+  >   true
+  > }
+  $ do_revert() {
+  >   hg revert -i
+  > }
+#endif
+
 When a line without EOL is selected during "revert -i"
 
   $ hg init $TESTTMP/revert-i-curses-eol
@@ -19,7 +36,7 @@
   $ echo 0 > a
   $ hg ci -qAm 0
   $ printf 1 >> a
-  $ hg ci -qAm 1
+  $ maybe_commit -qAm 1
   $ cat a
   0
   1 (no-eol)
@@ -28,7 +45,7 @@
   > c
   > EOF
 
-  $ hg revert -ir'.^'
+  $ do_revert
   reverting a
   $ cat a
   0
@@ -40,7 +57,7 @@
   $ printf 0 > a
   $ hg ci -qAm 0
   $ echo 0 > a
-  $ hg ci -qAm 1
+  $ maybe_commit -qAm 1
   $ cat a
   0
 
@@ -48,8 +65,9 @@
   > c
   > EOF
 
-  $ hg revert -ir'.^'
+  $ do_revert
   reverting a
   $ cat a
+  0 (wdir known-bad-output !)
   0 (no-eol)