sequencer: detect author name errors in read_author_script()
[git/debian.git] / t / t0067-parse_pathspec_file.sh
blob0188d0423a0aa246d40b0735a31470f1bb97e8a6
1 #!/bin/sh
3 test_description='Test parse_pathspec_file()'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'one item from stdin' '
9 cat >expect <<-\EOF &&
10 fileA.t
11 EOF
13 echo fileA.t |
14 test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
16 test_cmp expect actual
19 test_expect_success 'one item from file' '
20 cat >expect <<-\EOF &&
21 fileA.t
22 EOF
24 echo fileA.t >list &&
25 test-tool parse-pathspec-file --pathspec-from-file=list >actual &&
27 test_cmp expect actual
30 test_expect_success 'NUL delimiters' '
31 cat >expect <<-\EOF &&
32 fileA.t
33 fileB.t
34 EOF
36 printf "fileA.t\0fileB.t\0" |
37 test-tool parse-pathspec-file --pathspec-from-file=- --pathspec-file-nul >actual &&
39 test_cmp expect actual
42 test_expect_success 'LF delimiters' '
43 cat >expect <<-\EOF &&
44 fileA.t
45 fileB.t
46 EOF
48 printf "fileA.t\nfileB.t\n" |
49 test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
51 test_cmp expect actual
54 test_expect_success 'no trailing delimiter' '
55 cat >expect <<-\EOF &&
56 fileA.t
57 fileB.t
58 EOF
60 printf "fileA.t\nfileB.t" |
61 test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
63 test_cmp expect actual
66 test_expect_success 'CRLF delimiters' '
67 cat >expect <<-\EOF &&
68 fileA.t
69 fileB.t
70 EOF
72 printf "fileA.t\r\nfileB.t\r\n" |
73 test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
75 test_cmp expect actual
78 test_expect_success 'quotes' '
79 cat >expect <<-\EOF &&
80 fileA.t
81 EOF
83 cat >list <<-\EOF &&
84 "file\101.t"
85 EOF
87 test-tool parse-pathspec-file --pathspec-from-file=list >actual &&
89 test_cmp expect actual
92 test_expect_success '--pathspec-file-nul takes quotes literally' '
93 # Note: there is an extra newline because --pathspec-file-nul takes
94 # input \n literally, too
95 cat >expect <<-\EOF &&
96 "file\101.t"
98 EOF
100 cat >list <<-\EOF &&
101 "file\101.t"
104 test-tool parse-pathspec-file --pathspec-from-file=list --pathspec-file-nul >actual &&
106 test_cmp expect actual
109 test_done