@matheusbsbs / matheus-bagliano / commits / d21fc9342c
Fork 0

Add trivial tests for --stdin option to log family

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Nov 23, 2009 at 00:49 UTC d21fc9342cd82bb48bfbf9f54024ae2d4e16a9a3
1 file changed +61
t/t6017-rev-list-stdin.sh new
+61
@@ -0,0 +1,61 @@
1 +#!/bin/sh
2 +#
3 +# Copyright (c) 2009, Junio C Hamano
4 +#
5 +
6 +test_description='log family learns --stdin'
7 +
8 +. ./test-lib.sh
9 +
10 +check () {
11 + for cmd in rev-list "log --stat"
12 + do
13 + for i in "$@"
14 + do
15 + printf "%s\n" $i
16 + done >input &&
17 + test_expect_success "check $cmd $*" '
18 + git $cmd $(cat input) >expect &&
19 + git $cmd --stdin <input >actual &&
20 + sed -e "s/^/input /" input &&
21 + sed -e "s/^/output /" expect &&
22 + test_cmp expect actual
23 + '
24 + done
25 +}
26 +
27 +them='1 2 3 4 5 6 7'
28 +
29 +test_expect_success setup '
30 + (
31 + for i in 0 $them
32 + do
33 + for j in $them
34 + do
35 + echo $i.$j >file-$j &&
36 + git add file-$j || exit
37 + done &&
38 + test_tick &&
39 + git commit -m $i || exit
40 + done &&
41 + for i in $them
42 + do
43 + git checkout -b side-$i master~$i &&
44 + echo updated $i >file-$i &&
45 + git add file-$i &&
46 + test_tick &&
47 + git commit -m side-$i || exit
48 + done
49 + )
50 +'
51 +
52 +check master
53 +check side-1 ^side-4
54 +check side-1 ^side-7 --
55 +check side-1 ^side-7 -- file-1
56 +check side-1 ^side-7 -- file-2
57 +check side-3 ^side-4 -- file-3
58 +check side-3 ^side-2
59 +check side-3 ^side-2 -- file-1
60 +
61 +test_done