tests/test-run-tests.t
changeset 32982 573baab2a797
parent 32980 8dc62c97a665
child 33420 e80041832eec
--- a/tests/test-run-tests.t	Wed Jun 21 01:12:31 2017 -0700
+++ b/tests/test-run-tests.t	Wed Jun 21 01:12:31 2017 -0700
@@ -668,6 +668,58 @@
 
   $ rm test-race.t
 
+When "#testcases" is used in .t files
+
+  $ cat >> test-cases.t <<EOF
+  > #testcases a b
+  > #if a
+  >   $ echo 1
+  > #endif
+  > #if b
+  >   $ echo 2
+  > #endif
+  > EOF
+
+  $ cat <<EOF | rt -i test-cases.t 2>&1
+  > y
+  > y
+  > EOF
+  
+  --- $TESTTMP/test-cases.t
+  +++ $TESTTMP/test-cases.t.a.err
+  @@ -1,6 +1,7 @@
+   #testcases a b
+   #if a
+     $ echo 1
+  +  1
+   #endif
+   #if b
+     $ echo 2
+  Accept this change? [n] .
+  --- $TESTTMP/test-cases.t
+  +++ $TESTTMP/test-cases.t.b.err
+  @@ -5,4 +5,5 @@
+   #endif
+   #if b
+     $ echo 2
+  +  2
+   #endif
+  Accept this change? [n] .
+  # Ran 2 tests, 0 skipped, 0 failed.
+
+  $ cat test-cases.t
+  #testcases a b
+  #if a
+    $ echo 1
+    1
+  #endif
+  #if b
+    $ echo 2
+    2
+  #endif
+
+  $ rm test-cases.t
+
 (reinstall)
   $ mv backup test-failure.t