Use the final_oid_fn to finalize hashing of object IDs
[alt-git.git] / t / t0067-parse_pathspec_file.sh
blob7bab49f361a9bfea7cf72042d60e65b25698e5a9
1 #!/bin/sh
3 test_description='Test parse_pathspec_file()'
5 . ./test-lib.sh
7 test_expect_success 'one item from stdin' '
8 cat >expect <<-\EOF &&
9 fileA.t
10 EOF
12 echo fileA.t |
13 test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
15 test_cmp expect actual
18 test_expect_success 'one item from file' '
19 cat >expect <<-\EOF &&
20 fileA.t
21 EOF
23 echo fileA.t >list &&
24 test-tool parse-pathspec-file --pathspec-from-file=list >actual &&
26 test_cmp expect actual
29 test_expect_success 'NUL delimiters' '
30 cat >expect <<-\EOF &&
31 fileA.t
32 fileB.t
33 EOF
35 printf "fileA.t\0fileB.t\0" |
36 test-tool parse-pathspec-file --pathspec-from-file=- --pathspec-file-nul >actual &&
38 test_cmp expect actual
41 test_expect_success 'LF delimiters' '
42 cat >expect <<-\EOF &&
43 fileA.t
44 fileB.t
45 EOF
47 printf "fileA.t\nfileB.t\n" |
48 test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
50 test_cmp expect actual
53 test_expect_success 'no trailing delimiter' '
54 cat >expect <<-\EOF &&
55 fileA.t
56 fileB.t
57 EOF
59 printf "fileA.t\nfileB.t" |
60 test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
62 test_cmp expect actual
65 test_expect_success 'CRLF delimiters' '
66 cat >expect <<-\EOF &&
67 fileA.t
68 fileB.t
69 EOF
71 printf "fileA.t\r\nfileB.t\r\n" |
72 test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
74 test_cmp expect actual
77 test_expect_success 'quotes' '
78 cat >expect <<-\EOF &&
79 fileA.t
80 EOF
82 cat >list <<-\EOF &&
83 "file\101.t"
84 EOF
86 test-tool parse-pathspec-file --pathspec-from-file=list >actual &&
88 test_cmp expect actual
91 test_expect_success '--pathspec-file-nul takes quotes literally' '
92 # Note: there is an extra newline because --pathspec-file-nul takes
93 # input \n literally, too
94 cat >expect <<-\EOF &&
95 "file\101.t"
97 EOF
99 cat >list <<-\EOF &&
100 "file\101.t"
103 test-tool parse-pathspec-file --pathspec-from-file=list --pathspec-file-nul >actual &&
105 test_cmp expect actual
108 test_done