changeset 12141:5f44daa8fbd0

tests: unify test-diff-unified
author Adrian Buehlmann <adrian@cadifra.com>
date Tue, 31 Aug 2010 11:57:02 +0200
parents 552ea44c1842
children a55e3c50868f
files tests/test-diff-change.t tests/test-diff-hashes.t tests/test-diff-ignore-whitespace.t tests/test-diff-reverse.t tests/test-diff-subdir.t tests/test-diff-unified tests/test-diff-unified.out tests/test-diff-unified.t
diffstat 3 files changed, 109 insertions(+), 116 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-diff-unified	Tue Aug 31 11:14:48 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-#!/bin/sh
-
-hg init repo
-cd repo
-cat > a <<EOF
-c
-c
-a
-a
-b
-a
-a
-c
-c
-EOF
-hg ci -Am adda
-cat > a <<EOF
-c
-c
-a
-a
-dd
-a
-a
-c
-c
-EOF
-
-echo '% default context'
-hg diff --nodates
-
-echo '% invalid --unified'
-hg diff --nodates -U foo
-
-echo '% --unified=2'
-hg diff --nodates -U 2
-
-echo '% diff.unified=2'
-hg --config diff.unified=2 diff --nodates
-
-echo '% diff.unified=2 --unified=1'
-hg diff --nodates -U 1
-
-echo '% invalid diff.unified'
-hg --config diff.unified=foo diff --nodates
-
-echo % test off-by-one error with diff -p
-hg init diffp
-cd diffp
-echo a > a
-hg ci -Ama
-rm a
-echo b > a
-echo a >> a
-echo c >> a
-hg diff -U0 -p --nodates
-
-exit 0
--- a/tests/test-diff-unified.out	Tue Aug 31 11:14:48 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-adding a
-% default context
-diff -r cf9f4ba66af2 a
---- a/a
-+++ b/a
-@@ -2,7 +2,7 @@
- c
- a
- a
--b
-+dd
- a
- a
- c
-% invalid --unified
-abort: diff context lines count must be an integer, not 'foo'
-% --unified=2
-diff -r cf9f4ba66af2 a
---- a/a
-+++ b/a
-@@ -3,5 +3,5 @@
- a
- a
--b
-+dd
- a
- a
-% diff.unified=2
-diff -r cf9f4ba66af2 a
---- a/a
-+++ b/a
-@@ -3,5 +3,5 @@
- a
- a
--b
-+dd
- a
- a
-% diff.unified=2 --unified=1
-diff -r cf9f4ba66af2 a
---- a/a
-+++ b/a
-@@ -4,3 +4,3 @@
- a
--b
-+dd
- a
-% invalid diff.unified
-abort: diff context lines count must be an integer, not 'foo'
-% test off-by-one error with diff -p
-adding a
-diff -r cb9a9f314b8b a
---- a/a
-+++ b/a
-@@ -1,0 +1,1 @@
-+b
-@@ -2,0 +3,1 @@ a
-+c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-diff-unified.t	Tue Aug 31 11:57:02 2010 +0200
@@ -0,0 +1,109 @@
+  $ hg init repo
+  $ cd repo
+  $ cat > a <<EOF
+  > c
+  > c
+  > a
+  > a
+  > b
+  > a
+  > a
+  > c
+  > c
+  > EOF
+  $ hg ci -Am adda
+  adding a
+
+  $ cat > a <<EOF
+  > c
+  > c
+  > a
+  > a
+  > dd
+  > a
+  > a
+  > c
+  > c
+  > EOF
+
+default context
+
+  $ hg diff --nodates
+  diff -r cf9f4ba66af2 a
+  --- a/a
+  +++ b/a
+  @@ -2,7 +2,7 @@
+   c
+   a
+   a
+  -b
+  +dd
+   a
+   a
+   c
+
+invalid --unified
+
+  $ hg diff --nodates -U foo
+  abort: diff context lines count must be an integer, not 'foo'
+
+
+  $ hg diff --nodates -U 2
+  diff -r cf9f4ba66af2 a
+  --- a/a
+  +++ b/a
+  @@ -3,5 +3,5 @@
+   a
+   a
+  -b
+  +dd
+   a
+   a
+
+  $ hg --config diff.unified=2 diff --nodates
+  diff -r cf9f4ba66af2 a
+  --- a/a
+  +++ b/a
+  @@ -3,5 +3,5 @@
+   a
+   a
+  -b
+  +dd
+   a
+   a
+
+  $ hg diff --nodates -U 1
+  diff -r cf9f4ba66af2 a
+  --- a/a
+  +++ b/a
+  @@ -4,3 +4,3 @@
+   a
+  -b
+  +dd
+   a
+
+invalid diff.unified
+
+  $ hg --config diff.unified=foo diff --nodates
+  abort: diff context lines count must be an integer, not 'foo'
+
+test off-by-one error with diff -p
+
+  $ hg init diffp
+  $ cd diffp
+  $ echo a > a
+  $ hg ci -Ama
+  adding a
+  $ rm a
+  $ echo b > a
+  $ echo a >> a
+  $ echo c >> a
+  $ hg diff -U0 -p --nodates
+  diff -r cb9a9f314b8b a
+  --- a/a
+  +++ b/a
+  @@ -1,0 +1,1 @@
+  +b
+  @@ -2,0 +3,1 @@ a
+  +c
+