tests: unify test-add
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Thu, 12 Aug 2010 19:43:45 +0900
changeset 11795 06793ad30575
parent 11794 80c63b2a29a8
child 11796 141e2e964705
tests: unify test-add
tests/test-add
tests/test-add.out
tests/test-add.t
--- a/tests/test-add	Thu Aug 12 19:40:22 2010 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-#!/bin/sh
-
-hg init a
-cd a
-echo a > a
-hg add -n
-hg st
-hg add
-hg st
-hg forget a
-hg add
-hg st
-
-echo b > b
-hg add -n b
-hg st
-hg add b || echo "failed to add b"
-hg st
-echo % should fail
-hg add b
-hg st
-
-hg ci -m 0 --traceback
-echo % should fail
-hg add a
-
-echo aa > a
-hg ci -m 1
-hg up 0
-echo aaa > a
-hg ci -m 2
-
-hg merge
-hg st
-echo % should fail
-hg add a
-hg st
-hg resolve -m a
-hg ci -m merge
-
-echo % issue683
-hg forget a
-hg add a
-hg st
-hg rm a
-hg st
-echo a > a
-hg add a
-hg st
-
-hg add c && echo "unexpected addition of missing file"
-echo c > c
-hg add d c && echo "unexpected addition of missing file"
-hg st
-
--- a/tests/test-add.out	Thu Aug 12 19:40:22 2010 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-adding a
-? a
-adding a
-A a
-adding a
-A a
-A a
-? b
-A a
-A b
-% should fail
-b already tracked!
-A a
-A b
-% should fail
-a already tracked!
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-merging a
-warning: conflicts during merge.
-merging a failed!
-0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
-M a
-? a.orig
-% should fail
-a already tracked!
-M a
-? a.orig
-% issue683
-? a.orig
-R a
-? a.orig
-M a
-? a.orig
-c: No such file or directory
-d: No such file or directory
-M a
-A c
-? a.orig
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-add.t	Thu Aug 12 19:43:45 2010 +0900
@@ -0,0 +1,96 @@
+  $ hg init a
+  $ cd a
+  $ echo a > a
+  $ hg add -n
+  adding a
+  $ hg st
+  ? a
+  $ hg add
+  adding a
+  $ hg st
+  A a
+  $ hg forget a
+  $ hg add
+  adding a
+  $ hg st
+  A a
+
+  $ echo b > b
+  $ hg add -n b
+  $ hg st
+  A a
+  ? b
+  $ hg add b || echo "failed to add b"
+  $ hg st
+  A a
+  A b
+
+should fail
+
+  $ hg add b
+  b already tracked!
+  $ hg st
+  A a
+  A b
+
+  $ hg ci -m 0 --traceback
+
+should fail
+
+  $ hg add a
+  a already tracked!
+
+  $ echo aa > a
+  $ hg ci -m 1
+  $ hg up 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo aaa > a
+  $ hg ci -m 2
+  created new head
+
+  $ hg merge
+  merging a
+  warning: conflicts during merge.
+  merging a failed!
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
+  $ hg st
+  M a
+  ? a.orig
+
+should fail
+
+  $ hg add a
+  a already tracked!
+  $ hg st
+  M a
+  ? a.orig
+  $ hg resolve -m a
+  $ hg ci -m merge
+
+issue683
+
+  $ hg forget a
+  $ hg add a
+  $ hg st
+  ? a.orig
+  $ hg rm a
+  $ hg st
+  R a
+  ? a.orig
+  $ echo a > a
+  $ hg add a
+  $ hg st
+  M a
+  ? a.orig
+
+  $ hg add c && echo "unexpected addition of missing file"
+  c: No such file or directory
+  $ echo c > c
+  $ hg add d c && echo "unexpected addition of missing file"
+  d: No such file or directory
+  $ hg st
+  M a
+  A c
+  ? a.orig
+