crecord: add test demonstrating issue when reverting noeol->eol change
authorKyle Lippincott <spectral@google.com>
Tue, 05 Apr 2022 11:09:57 -0700
changeset 49098 9a5d09d7f108
parent 49097 3f6ef67e7a60
child 49099 079197e94b24
crecord: add test demonstrating issue when reverting noeol->eol change Differential Revision: https://phab.mercurial-scm.org/D12440
tests/test-revert-interactive-curses.t
--- 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)