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

t3000 (ls-files -o): modernize style

This script is part of the second batch of tests, from the same day the test infrastructure was added to git. Update it to use a more modern style in the spirit of v1.6.4-rc0~45^2~2 (2009-05-22). In particular: - Put setup code inside test assertions, to avoid unexpected breakages and avoid stray output without -v (as t/README recommends); and - Put the test title on the same line as the "test_expect_success", and end the line with a single-quote to begin the body of the test which is one multi-line string. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Nieder committed Jul 10, 2010 at 23:20 UTC bcefed419aee75ff1c358dc0794c55b07d87dbc9
1 file changed +42 -47
t/t3000-ls-files-others.sh
+42 -47
@@ -17,57 +17,52 @@ filesystem.
17 '
18 . ./test-lib.sh
19
20 -date >path0
21 -if test_have_prereq SYMLINKS
22 -then
23 - ln -s xyzzy path1
24 -else
25 - date > path1
26 -fi
27 -mkdir path2 path3 path4
28 -date >path2/file2
29 -date >path2-junk
30 -date >path3/file3
31 -date >path3-junk
32 -git update-index --add path3-junk path3/file3
33 -
34 -cat >expected1 <<EOF
35 -expected1
36 -expected2
37 -expected3
38 -output
39 -path0
40 -path1
41 -path2-junk
42 -path2/file2
43 -EOF
44 -sed -e 's|path2/file2|path2/|' <expected1 >expected2
45 -cat <expected2 >expected3
46 -echo path4/ >>expected2
47 -
48 -test_expect_success \
49 - 'git ls-files --others to show output.' \
50 - 'git ls-files --others >output'
51 -
52 -test_expect_success \
53 - 'git ls-files --others should pick up symlinks.' \
54 - 'test_cmp expected1 output'
20 +test_expect_success 'setup ' '
21 + date >path0 &&
22 + if test_have_prereq SYMLINKS
23 + then
24 + ln -s xyzzy path1
25 + else
26 + date >path1
27 + fi &&
28 + mkdir path2 path3 path4 &&
29 + date >path2/file2 &&
30 + date >path2-junk &&
31 + date >path3/file3 &&
32 + date >path3-junk &&
33 + git update-index --add path3-junk path3/file3
34 +'
35
56 -test_expect_success \
57 - 'git ls-files --others --directory to show output.' \
58 - 'git ls-files --others --directory >output'
36 +test_expect_success 'setup: expected output' '
37 + cat >expected1 <<-\EOF &&
38 + expected1
39 + expected2
40 + expected3
41 + output
42 + path0
43 + path1
44 + path2-junk
45 + path2/file2
46 + EOF
47
48 + sed -e "s|path2/file2|path2/|" <expected1 >expected2 &&
49 + cp expected2 expected3 &&
50 + echo path4/ >>expected2
51 +'
52
61 -test_expect_success \
62 - 'git ls-files --others --directory should not get confused.' \
63 - 'test_cmp expected2 output'
53 +test_expect_success 'ls-files --others' '
54 + git ls-files --others >output &&
55 + test_cmp expected1 output
56 +'
57
65 -test_expect_success \
66 - 'git ls-files --others --directory --no-empty-directory to show output.' \
67 - 'git ls-files --others --directory --no-empty-directory >output'
58 +test_expect_success 'ls-files --others --directory' '
59 + git ls-files --others --directory >output &&
60 + test_cmp expected2 output
61 +'
62
69 -test_expect_success \
70 - '--no-empty-directory hides empty directory' \
71 - 'test_cmp expected3 output'
63 +test_expect_success '--no-empty-directory hides empty directory' '
64 + git ls-files --others --directory --no-empty-directory >output &&
65 + test_cmp expected3 output
66 +'
67
68 test_done