libgit-thin: Update QUESTIONS file
[git/libgit-gsoc.git] / t / t3902-quoted.sh
blob63f950b179586b2f8f7bf8d3695262795d546465
1 #!/bin/sh
3 # Copyright (c) 2006 Junio C Hamano
6 test_description='quoted output'
8 . ./test-lib.sh
10 FN='濱野'
11 GN='純'
12 HT=' '
13 LF='
15 DQ='"'
17 for_each_name () {
18 for name in \
19 Name "Name and a${LF}LF" "Name and an${HT}HT" "Name${DQ}" \
20 "$FN$HT$GN" "$FN$LF$GN" "$FN $GN" "$FN$GN" "$FN$DQ$GN" \
21 "With SP in it"
23 eval "$1"
24 done
27 test_expect_success setup '
29 for_each_name "echo initial >\"\$name\""
30 git add . &&
31 git commit -q -m Initial &&
33 for_each_name "echo second >\"\$name\"" &&
34 git commit -a -m Second
36 for_each_name "echo modified >\"\$name\""
40 cat >expect.quoted <<\EOF
41 Name
42 "Name and a\nLF"
43 "Name and an\tHT"
44 "Name\""
45 With SP in it
46 "\346\277\261\351\207\216\t\347\264\224"
47 "\346\277\261\351\207\216\n\347\264\224"
48 "\346\277\261\351\207\216 \347\264\224"
49 "\346\277\261\351\207\216\"\347\264\224"
50 "\346\277\261\351\207\216\347\264\224"
51 EOF
53 cat >expect.raw <<\EOF
54 Name
55 "Name and a\nLF"
56 "Name and an\tHT"
57 "Name\""
58 With SP in it
59 "濱野\t純"
60 "濱野\n純"
61 濱野 純
62 "濱野\"純"
63 濱野純
64 EOF
66 test_expect_success 'check fully quoted output from ls-files' '
68 git ls-files >current && diff -u expect.quoted current
72 test_expect_success 'check fully quoted output from diff-files' '
74 git diff --name-only >current &&
75 diff -u expect.quoted current
79 test_expect_success 'check fully quoted output from diff-index' '
81 git diff --name-only HEAD >current &&
82 diff -u expect.quoted current
86 test_expect_success 'check fully quoted output from diff-tree' '
88 git diff --name-only HEAD^ HEAD >current &&
89 diff -u expect.quoted current
93 test_expect_success 'setting core.quotepath' '
95 git config --bool core.quotepath false
99 test_expect_success 'check fully quoted output from ls-files' '
101 git ls-files >current && diff -u expect.raw current
105 test_expect_success 'check fully quoted output from diff-files' '
107 git diff --name-only >current &&
108 diff -u expect.raw current
112 test_expect_success 'check fully quoted output from diff-index' '
114 git diff --name-only HEAD >current &&
115 diff -u expect.raw current
119 test_expect_success 'check fully quoted output from diff-tree' '
121 git diff --name-only HEAD^ HEAD >current &&
122 diff -u expect.raw current
126 test_done