From: Bo Yang <struggleyb.nku@gmail.com>
To: git@vger.kernel.org
Cc: trast@student.ethz.ch, Jens.Lehmann@web.de
Subject: [PATCH v4 17/18] Add test cases for '--graph' of line level log
Date: Fri, 6 Aug 2010 00:11:56 +0800 [thread overview]
Message-ID: <1281024717-7855-18-git-send-email-struggleyb.nku@gmail.com> (raw)
In-Reply-To: <1281024717-7855-1-git-send-email-struggleyb.nku@gmail.com>
t/t4301-log-line-single-history.sh:
test the linear line of history with '--graph' option;
t/t4302-log-line-merge-history.sh:
test the case that there are merges in the history with
'--graph' option.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
---
t/t4301-log-line-single-history.sh | 277 ++++++++++++++++++++++++++++++++++++
t/t4302-log-line-merge-history.sh | 51 +++++++-
2 files changed, 327 insertions(+), 1 deletions(-)
diff --git a/t/t4301-log-line-single-history.sh b/t/t4301-log-line-single-history.sh
index 9cf34f8..84bea11 100755
--- a/t/t4301-log-line-single-history.sh
+++ b/t/t4301-log-line-single-history.sh
@@ -339,4 +339,281 @@ test_expect_success \
test_cmp current-linenum expected-linenum &&
test_cmp current-always expected-always'
+# Rerun all log with graph
+test_expect_success \
+ 'Show the line level log of path0 with --graph' \
+ 'git log --pretty=format:%s%n%b --graph -L /func/,/^}/ path0 > current-path0-graph'
+
+test_expect_success \
+ 'Show the line level log of path1 with --graph' \
+ 'git log --pretty=format:%s%n%b --graph -L /output/,/^}/ path1 > current-path1-graph'
+
+test_expect_success \
+ 'Show the line level log of two files with --graph' \
+ 'git log --pretty=format:%s%n%b --graph -L /func/,/^}/ path0 --graph -L /output/,/^}/ path1 > current-pathall-graph'
+
+test_expect_success \
+ 'Test the line number argument with --graph' \
+ 'git log --pretty=format:%s%n%b --graph -L 1,2 path0 > current-linenum-graph'
+
+test_expect_success \
+ 'Test the --full-line-diff option with --graph option' \
+ 'git log --pretty=format:%s%n%b --full-line-diff --graph -L 1,2 path0 > current-always-graph'
+
+cat > expected-path0-graph <<\EOF
+* Final change of path0
+|
+| diff --git a/path0 b/path0
+| index 44db133..1518c15 100644
+| --- a/path0
+| +++ b/path0
+| @@ -1,6 +1,5 @@
+| void func(){
+| int a = 10;
+| int b = 11;
+| - int c;
+| - c = 10 * (a + b);
+| + printf("%d", a - b);
+| }
+|
+* Change the 5th line of path0
+|
+| diff --git a/path0 b/path0
+| index 9ef1692..44db133 100644
+| --- a/path0
+| +++ b/path0
+| @@ -1,6 +1,6 @@
+| void func(){
+| int a = 10;
+| int b = 11;
+| int c;
+| - c = a + b;
+| + c = 10 * (a + b);
+| }
+|
+* Change 2,3 lines of path0 and path1
+|
+| diff --git a/path0 b/path0
+| index aabffdf..9ef1692 100644
+| --- a/path0
+| +++ b/path0
+| @@ -1,6 +1,6 @@
+| void func(){
+| - int a = 0;
+| - int b = 1;
+| + int a = 10;
+| + int b = 11;
+| int c;
+| c = a + b;
+| }
+|
+* Base commit
+
+ diff --git a/path0 b/path0
+ new file mode 100644
+ index 0000000..aabffdf
+ --- /dev/null
+ +++ b/path0
+ @@ -0,0 +1,6 @@
+ +void func(){
+ + int a = 0;
+ + int b = 1;
+ + int c;
+ + c = a + b;
+ +}
+EOF
+
+cat > expected-path1-graph <<\EOF
+* Change 2,3 lines of path0 and path1
+|
+| diff --git a/path1 b/path1
+| index 997d841..1d711b5 100644
+| --- a/path1
+| +++ b/path1
+| @@ -1,3 +1,4 @@
+| void output(){
+| - printf("hello world");
+| + const char *str = "hello world!";
+| + printf("%s", str);
+| }
+|
+* Base commit
+
+ diff --git a/path1 b/path1
+ new file mode 100644
+ index 0000000..997d841
+ --- /dev/null
+ +++ b/path1
+ @@ -0,0 +1,3 @@
+ +void output(){
+ + printf("hello world");
+ +}
+EOF
+
+cat > expected-pathall-graph <<\EOF
+* Final change of path0
+|
+| diff --git a/path0 b/path0
+| index 44db133..1518c15 100644
+| --- a/path0
+| +++ b/path0
+| @@ -1,6 +1,5 @@
+| void func(){
+| int a = 10;
+| int b = 11;
+| - int c;
+| - c = 10 * (a + b);
+| + printf("%d", a - b);
+| }
+|
+* Change the 5th line of path0
+|
+| diff --git a/path0 b/path0
+| index 9ef1692..44db133 100644
+| --- a/path0
+| +++ b/path0
+| @@ -1,6 +1,6 @@
+| void func(){
+| int a = 10;
+| int b = 11;
+| int c;
+| - c = a + b;
+| + c = 10 * (a + b);
+| }
+|
+* Change 2,3 lines of path0 and path1
+|
+| diff --git a/path0 b/path0
+| index aabffdf..9ef1692 100644
+| --- a/path0
+| +++ b/path0
+| @@ -1,6 +1,6 @@
+| void func(){
+| - int a = 0;
+| - int b = 1;
+| + int a = 10;
+| + int b = 11;
+| int c;
+| c = a + b;
+| }
+| diff --git a/path1 b/path1
+| index 997d841..1d711b5 100644
+| --- a/path1
+| +++ b/path1
+| @@ -1,3 +1,4 @@
+| void output(){
+| - printf("hello world");
+| + const char *str = "hello world!";
+| + printf("%s", str);
+| }
+|
+* Base commit
+
+ diff --git a/path0 b/path0
+ new file mode 100644
+ index 0000000..aabffdf
+ --- /dev/null
+ +++ b/path0
+ @@ -0,0 +1,6 @@
+ +void func(){
+ + int a = 0;
+ + int b = 1;
+ + int c;
+ + c = a + b;
+ +}
+ diff --git a/path1 b/path1
+ new file mode 100644
+ index 0000000..997d841
+ --- /dev/null
+ +++ b/path1
+ @@ -0,0 +1,3 @@
+ +void output(){
+ + printf("hello world");
+ +}
+EOF
+
+cat > expected-linenum-graph <<\EOF
+* Change 2,3 lines of path0 and path1
+|
+| diff --git a/path0 b/path0
+| index aabffdf..9ef1692 100644
+| --- a/path0
+| +++ b/path0
+| @@ -1,2 +1,2 @@
+| void func(){
+| - int a = 0;
+| + int a = 10;
+|
+* Base commit
+
+ diff --git a/path0 b/path0
+ new file mode 100644
+ index 0000000..aabffdf
+ --- /dev/null
+ +++ b/path0
+ @@ -0,0 +1,2 @@
+ +void func(){
+ + int a = 0;
+EOF
+
+cat > expected-always-graph <<\EOF
+* Final change of path0
+|
+| diff --git a/path0 b/path0
+| index 44db133..1518c15 100644
+| --- a/path0
+| +++ b/path0
+| @@ -1,2 +1,2 @@
+| void func(){
+| int a = 10;
+|
+* Change the 5th line of path0
+|
+| diff --git a/path0 b/path0
+| index 9ef1692..44db133 100644
+| --- a/path0
+| +++ b/path0
+| @@ -1,2 +1,2 @@
+| void func(){
+| int a = 10;
+|
+* Change 2,3 lines of path0 and path1
+|
+| diff --git a/path0 b/path0
+| index aabffdf..9ef1692 100644
+| --- a/path0
+| +++ b/path0
+| @@ -1,2 +1,2 @@
+| void func(){
+| - int a = 0;
+| + int a = 10;
+|
+* Base commit
+
+ diff --git a/path0 b/path0
+ new file mode 100644
+ index 0000000..aabffdf
+ --- /dev/null
+ +++ b/path0
+ @@ -0,0 +1,2 @@
+ +void func(){
+ + int a = 0;
+EOF
+
+test_expect_success \
+ 'validate the path0 output.' \
+ 'test_cmp current-path0-graph expected-path0-graph'
+test_expect_success \
+ 'validate the path1 output.' \
+ 'test_cmp current-path1-graph expected-path1-graph'
+test_expect_success \
+ 'validate the all path output.' \
+ 'test_cmp current-pathall-graph expected-pathall-graph'
+test_expect_success \
+ 'validate graph output' \
+ 'test_cmp current-linenum-graph expected-linenum-graph'
+test_expect_success \
+ 'validate --full-line-diff output' \
+ 'test_cmp current-always-graph expected-always-graph'
+
test_done
diff --git a/t/t4302-log-line-merge-history.sh b/t/t4302-log-line-merge-history.sh
index 02e7439..1536cc4 100755
--- a/t/t4302-log-line-merge-history.sh
+++ b/t/t4302-log-line-merge-history.sh
@@ -66,7 +66,6 @@ Merge two branches
nontrivial merge found
path0
-
@@ 2,1 @@
printf("hello earth and moon");
@@ -107,8 +106,58 @@ index 0000000..f628dea
+ printf("hello");
+}
EOF
+
+cat > expected-graph <<\EOF
+* Merge two branches
+|\
+| |
+| | nontrivial merge found
+| | path0
+| | @@ 2,1 @@
+| | printf("hello earth and moon");
+| |
+| |
+| * Change path0 in master
+| |
+| | diff --git a/path0 b/path0
+| | index f628dea..bef7fa3 100644
+| | --- a/path0
+| | +++ b/path0
+| | @@ -2,1 +2,1 @@
+| | - printf("hello");
+| | + printf("hello earth");
+| |
+* | Change path0 in feature
+|/
+|
+| diff --git a/path0 b/path0
+| index f628dea..a940ef6 100644
+| --- a/path0
+| +++ b/path0
+| @@ -2,1 +2,1 @@
+| - printf("hello");
+| + print("hello moon");
+|
+* Base commit
+
+ diff --git a/path0 b/path0
+ new file mode 100644
+ index 0000000..f628dea
+ --- /dev/null
+ +++ b/path0
+ @@ -0,0 +2,1 @@
+ + printf("hello");
+EOF
+
+test_expect_success \
+ 'Show the line log of the 2 line of path0 with graph' \
+ 'git log --pretty=format:%s%n%b --graph -L 2,+1 path0 > current-graph'
+
test_expect_success \
'validate the output.' \
'test_cmp current expected'
+test_expect_success \
+ 'validate the graph output.' \
+ 'test_cmp current-graph expected-graph'
test_done
--
1.7.2.20.g388bbb
next prev parent reply other threads:[~2010-08-05 16:14 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 16:11 [PATCH v4 00/18] Reroll the line log series Bo Yang
2010-08-05 16:11 ` [PATCH v4 01/18] parse-options: enhance STOP_AT_NON_OPTION Bo Yang
2010-08-05 16:11 ` [PATCH v4 02/18] parse-options: add two helper functions Bo Yang
2010-08-05 20:43 ` Thomas Rast
2010-08-05 16:11 ` [PATCH v4 03/18] Add the basic data structure for line level history Bo Yang
2010-08-05 21:09 ` Thomas Rast
2010-08-06 19:42 ` Junio C Hamano
2010-08-05 16:11 ` [PATCH v4 04/18] Refactor parse_loc Bo Yang
2010-08-05 16:11 ` [PATCH v4 05/18] Parse the -L options Bo Yang
2010-08-06 19:42 ` Junio C Hamano
2010-08-10 15:40 ` Bo Yang
2010-08-05 16:11 ` [PATCH v4 06/18] Export three functions from diff.c Bo Yang
2010-08-05 16:11 ` [PATCH v4 07/18] Add range clone functions Bo Yang
2010-08-05 16:11 ` [PATCH v4 08/18] map/take range to the parent of commits Bo Yang
2010-08-05 21:32 ` Thomas Rast
2010-08-05 16:11 ` [PATCH v4 09/18] Print the line log Bo Yang
2010-08-05 16:11 ` [PATCH v4 10/18] Hook line history into cmd_log, ensuring a topo-ordered walk Bo Yang
2010-08-05 16:11 ` [PATCH v4 11/18] Add tests for line history browser Bo Yang
2010-08-05 20:38 ` Thomas Rast
2010-08-06 5:28 ` Bo Yang
2010-08-06 9:04 ` Thomas Rast
2010-08-05 16:11 ` [PATCH v4 12/18] Make rewrite_parents public to other part of git Bo Yang
2010-08-05 16:11 ` [PATCH v4 13/18] Make graph_next_line external " Bo Yang
2010-08-05 16:11 ` [PATCH v4 14/18] Add parent rewriting to line history browser Bo Yang
2010-08-05 16:11 ` [PATCH v4 15/18] Add --graph prefix before line history output Bo Yang
2010-08-05 16:11 ` [PATCH v4 16/18] Add --full-line-diff option Bo Yang
2010-08-05 16:11 ` Bo Yang [this message]
2010-08-05 16:11 ` [PATCH v4 18/18] Document line history browser Bo Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1281024717-7855-18-git-send-email-struggleyb.nku@gmail.com \
--to=struggleyb.nku@gmail.com \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=trast@student.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).