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

i18n: use test_i18n{grep,cmp} in t7508

Two tests looked for "[Uu]sage" in the output, but we cannot expect the l10n to use that phrase. Mark them with test_i18ngrep so that in later versions we can test truly localized versions with the same tests, not just GETTEXT_POISON that happens to keep the original string in the output. Merge a few tests that were artificially split into "do" and "test output under C_LOCALE_OUTPUT" in the original i18n patches back. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Apr 14, 2011 at 13:56 UTC cc6658e7b4baad88ea30b0a1c8d4857f6253c2b0
1 file changed +102 -120
t/t7508-status.sh
+102 -120
@@ -16,7 +16,7 @@ test_expect_success 'status -h in broken repository' '
16 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
17 test_expect_code 129 git status -h >usage 2>&1
18 ) &&
19 - grep "[Uu]sage" broken/usage
19 + test_i18ngrep "[Uu]sage" broken/usage
20 '
21
22 test_expect_success 'commit -h in broken repository' '
@@ -28,7 +28,7 @@ test_expect_success 'commit -h in broken repository' '
28 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
29 test_expect_code 129 git commit -h >usage 2>&1
30 ) &&
31 - grep "[Uu]sage" broken/usage
31 + test_i18ngrep "[Uu]sage" broken/usage
32 '
33
34 test_expect_success 'setup' '
@@ -55,10 +55,8 @@ test_expect_success 'setup' '
55 git add dir2/added
56 '
57
58 -test_expect_success C_LOCALE_OUTPUT 'status (1)' '
59 -
60 - grep "use \"git rm --cached <file>\.\.\.\" to unstage" output
61 -
58 +test_expect_success 'status (1)' '
59 + test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output
60 '
61
62 cat >expect <<\EOF
@@ -85,11 +83,9 @@ cat >expect <<\EOF
83 # untracked
84 EOF
85
88 -test_expect_success C_LOCALE_OUTPUT 'status (2)' '
89 -
86 +test_expect_success 'status (2)' '
87 git status >output &&
91 - test_cmp expect output
92 -
88 + test_i18ncmp expect output
89 '
90
91 cat >expect <<\EOF
@@ -109,17 +105,14 @@ cat >expect <<\EOF
105 # untracked
106 EOF
107
112 -git config advice.statusHints false
113 -
114 -test_expect_success C_LOCALE_OUTPUT 'status (advice.statusHints false)' '
115 -
108 +test_expect_success 'status (advice.statusHints false)' '
109 + test_when_finished "git config --unset advice.statusHints" &&
110 + git config advice.statusHints false &&
111 git status >output &&
117 - test_cmp expect output
112 + test_i18ncmp expect output
113
114 '
115
121 -git config --unset advice.statusHints
122 -
116 cat >expect <<\EOF
117 M dir1/modified
118 A dir2/added
@@ -178,16 +171,16 @@ cat >expect <<EOF
171 #
172 # Untracked files not listed (use -u option to show untracked files)
173 EOF
181 -test_expect_success C_LOCALE_OUTPUT 'status -uno' '
174 +test_expect_success 'status -uno' '
175 git status -uno >output &&
183 - test_cmp expect output
176 + test_i18ncmp expect output
177 '
178
186 -test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles no)' '
179 +test_expect_success 'status (status.showUntrackedFiles no)' '
180 git config status.showuntrackedfiles no
181 test_when_finished "git config --unset status.showuntrackedfiles" &&
182 git status >output &&
190 - test_cmp expect output
183 + test_i18ncmp expect output
184 '
185
186 cat >expect <<EOF
@@ -201,9 +194,9 @@ cat >expect <<EOF
194 # Untracked files not listed
195 EOF
196 git config advice.statusHints false
204 -test_expect_success C_LOCALE_OUTPUT 'status -uno (advice.statusHints false)' '
197 +test_expect_success 'status -uno (advice.statusHints false)' '
198 git status -uno >output &&
206 - test_cmp expect output
199 + test_i18ncmp expect output
200 '
201 git config --unset advice.statusHints
202
@@ -246,16 +239,16 @@ cat >expect <<EOF
239 # output
240 # untracked
241 EOF
249 -test_expect_success C_LOCALE_OUTPUT 'status -unormal' '
242 +test_expect_success 'status -unormal' '
243 git status -unormal >output &&
251 - test_cmp expect output
244 + test_i18ncmp expect output
245 '
246
254 -test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles normal)' '
247 +test_expect_success 'status (status.showUntrackedFiles normal)' '
248 git config status.showuntrackedfiles normal
249 test_when_finished "git config --unset status.showuntrackedfiles" &&
250 git status >output &&
258 - test_cmp expect output
251 + test_i18ncmp expect output
252 '
253
254 cat >expect <<EOF
@@ -305,15 +298,16 @@ cat >expect <<EOF
298 # output
299 # untracked
300 EOF
308 -test_expect_success C_LOCALE_OUTPUT 'status -uall' '
301 +test_expect_success 'status -uall' '
302 git status -uall >output &&
310 - test_cmp expect output
303 + test_i18ncmp expect output
304 '
312 -test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles all)' '
305 +
306 +test_expect_success 'status (status.showUntrackedFiles all)' '
307 git config status.showuntrackedfiles all
308 test_when_finished "git config --unset status.showuntrackedfiles" &&
309 git status >output &&
316 - test_cmp expect output
310 + test_i18ncmp expect output
311 '
312
313 test_expect_success 'teardown dir3' '
@@ -367,11 +361,9 @@ cat >expect <<\EOF
361 # ../untracked
362 EOF
363
370 -test_expect_success C_LOCALE_OUTPUT 'status with relative paths' '
371 -
364 +test_expect_success 'status with relative paths' '
365 (cd dir1 && git status) >output &&
373 - test_cmp expect output
374 -
366 + test_i18ncmp expect output
367 '
368
369 cat >expect <<\EOF
@@ -440,22 +432,18 @@ cat >expect <<\EOF
432 # <BLUE>untracked<RESET>
433 EOF
434
443 -test_expect_success C_LOCALE_OUTPUT 'status with color.ui' '
444 -
435 +test_expect_success 'status with color.ui' '
436 git config color.ui always &&
437 test_when_finished "git config --unset color.ui" &&
438 git status | test_decode_color >output &&
448 - test_cmp expect output
449 -
439 + test_i18ncmp expect output
440 '
441
452 -test_expect_success C_LOCALE_OUTPUT 'status with color.status' '
453 -
442 +test_expect_success 'status with color.status' '
443 git config color.status always &&
444 test_when_finished "git config --unset color.status" &&
445 git status | test_decode_color >output &&
457 - test_cmp expect output
458 -
446 + test_i18ncmp expect output
447 '
448
449 cat >expect <<\EOF
@@ -570,12 +558,12 @@ cat >expect <<\EOF
558 EOF
559
560
573 -test_expect_success C_LOCALE_OUTPUT 'status without relative paths' '
561 +test_expect_success 'status without relative paths' '
562
563 git config status.relativePaths false &&
564 test_when_finished "git config --unset status.relativePaths" &&
565 (cd dir1 && git status) >output &&
578 - test_cmp expect output
566 + test_i18ncmp expect output
567
568 '
569
@@ -616,11 +604,8 @@ cat <<EOF >expect
604 # untracked
605 EOF
606 test_expect_success 'dry-run of partial commit excluding new file in index' '
619 - git commit --dry-run dir1/modified >output
620 -'
621 -
622 -test_expect_success C_LOCALE_OUTPUT 'dry-run of partial commit excluding new file in index: output' '
623 - test_cmp expect output
607 + git commit --dry-run dir1/modified >output &&
608 + test_i18ncmp expect output
609 '
610
611 cat >expect <<EOF
@@ -667,15 +652,15 @@ cat >expect <<EOF
652 # output
653 # untracked
654 EOF
670 -test_expect_success C_LOCALE_OUTPUT 'status submodule summary is disabled by default' '
655 +test_expect_success 'status submodule summary is disabled by default' '
656 git status >output &&
672 - test_cmp expect output
657 + test_i18ncmp expect output
658 '
659
660 # we expect the same as the previous test
676 -test_expect_success C_LOCALE_OUTPUT 'status --untracked-files=all does not show submodule' '
661 +test_expect_success 'status --untracked-files=all does not show submodule' '
662 git status --untracked-files=all >output &&
678 - test_cmp expect output
663 + test_i18ncmp expect output
664 '
665
666 cat >expect <<EOF
@@ -731,10 +716,10 @@ cat >expect <<EOF
716 # output
717 # untracked
718 EOF
734 -test_expect_success C_LOCALE_OUTPUT 'status submodule summary' '
719 +test_expect_success 'status submodule summary' '
720 git config status.submodulesummary 10 &&
721 git status >output &&
737 - test_cmp expect output
722 + test_i18ncmp expect output
723 '
724
725 cat >expect <<EOF
@@ -773,15 +758,12 @@ cat >expect <<EOF
758 no changes added to commit (use "git add" and/or "git commit -a")
759 EOF
760 test_expect_success 'status submodule summary (clean submodule): commit' '
776 - git commit -m "commit submodule"
777 -'
778 -
779 -test_expect_success C_LOCALE_OUTPUT 'status submodule summary (clean submodule): output' '
761 + git commit -m "commit submodule" &&
762 git config status.submodulesummary 10 &&
763 test_must_fail git commit --dry-run >output &&
782 - test_cmp expect output &&
764 + test_i18ncmp expect output &&
765 git status >output &&
784 - test_cmp expect output
766 + test_i18ncmp expect output
767 '
768
769 cat >expect <<EOF
@@ -827,10 +809,10 @@ cat >expect <<EOF
809 # output
810 # untracked
811 EOF
830 -test_expect_success C_LOCALE_OUTPUT 'commit --dry-run submodule summary (--amend)' '
812 +test_expect_success 'commit --dry-run submodule summary (--amend)' '
813 git config status.submodulesummary 10 &&
814 git commit --dry-run --amend >output &&
833 - test_cmp expect output
815 + test_i18ncmp expect output
816 '
817
818 test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
@@ -882,84 +864,84 @@ cat > expect << EOF
864 # untracked
865 EOF
866
885 -test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=untracked suppresses submodules with untracked content' '
886 - echo modified > sm/untracked &&
887 - git status --ignore-submodules=untracked > output &&
888 - test_cmp expect output
867 +test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
868 + echo modified sm/untracked &&
869 + git status --ignore-submodules=untracked >output &&
870 + test_i18ncmp expect output
871 '
872
891 -test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=untracked suppresses submodules with untracked content' '
873 +test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
874 git config diff.ignoreSubmodules dirty &&
875 git status >output &&
894 - test_cmp expect output &&
876 + test_i18ncmp expect output &&
877 git config --add -f .gitmodules submodule.subname.ignore untracked &&
878 git config --add -f .gitmodules submodule.subname.path sm &&
897 - git status > output &&
898 - test_cmp expect output &&
879 + git status >output &&
880 + test_i18ncmp expect output &&
881 git config -f .gitmodules --remove-section submodule.subname &&
882 git config --unset diff.ignoreSubmodules
883 '
884
903 -test_expect_success C_LOCALE_OUTPUT '.git/config ignore=untracked suppresses submodules with untracked content' '
885 +test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
886 git config --add -f .gitmodules submodule.subname.ignore none &&
887 git config --add -f .gitmodules submodule.subname.path sm &&
888 git config --add submodule.subname.ignore untracked &&
889 git config --add submodule.subname.path sm &&
908 - git status > output &&
909 - test_cmp expect output &&
890 + git status >output &&
891 + test_i18ncmp expect output &&
892 git config --remove-section submodule.subname &&
893 git config --remove-section -f .gitmodules submodule.subname
894 '
895
914 -test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=dirty suppresses submodules with untracked content' '
915 - git status --ignore-submodules=dirty > output &&
916 - test_cmp expect output
896 +test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
897 + git status --ignore-submodules=dirty >output &&
898 + test_i18ncmp expect output
899 '
900
919 -test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=dirty suppresses submodules with untracked content' '
901 +test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
902 git config diff.ignoreSubmodules dirty &&
903 git status >output &&
904 ! test -s actual &&
905 git config --add -f .gitmodules submodule.subname.ignore dirty &&
906 git config --add -f .gitmodules submodule.subname.path sm &&
925 - git status > output &&
926 - test_cmp expect output &&
907 + git status >output &&
908 + test_i18ncmp expect output &&
909 git config -f .gitmodules --remove-section submodule.subname &&
910 git config --unset diff.ignoreSubmodules
911 '
912
931 -test_expect_success C_LOCALE_OUTPUT '.git/config ignore=dirty suppresses submodules with untracked content' '
913 +test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
914 git config --add -f .gitmodules submodule.subname.ignore none &&
915 git config --add -f .gitmodules submodule.subname.path sm &&
916 git config --add submodule.subname.ignore dirty &&
917 git config --add submodule.subname.path sm &&
936 - git status > output &&
937 - test_cmp expect output &&
918 + git status >output &&
919 + test_i18ncmp expect output &&
920 git config --remove-section submodule.subname &&
921 git config -f .gitmodules --remove-section submodule.subname
922 '
923
942 -test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=dirty suppresses submodules with modified content' '
943 - echo modified > sm/foo &&
944 - git status --ignore-submodules=dirty > output &&
945 - test_cmp expect output
924 +test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
925 + echo modified >sm/foo &&
926 + git status --ignore-submodules=dirty >output &&
927 + test_i18ncmp expect output
928 '
929
948 -test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=dirty suppresses submodules with modified content' '
930 +test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
931 git config --add -f .gitmodules submodule.subname.ignore dirty &&
932 git config --add -f .gitmodules submodule.subname.path sm &&
951 - git status > output &&
952 - test_cmp expect output &&
933 + git status >output &&
934 + test_i18ncmp expect output &&
935 git config -f .gitmodules --remove-section submodule.subname
936 '
937
956 -test_expect_success C_LOCALE_OUTPUT '.git/config ignore=dirty suppresses submodules with modified content' '
938 +test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
939 git config --add -f .gitmodules submodule.subname.ignore none &&
940 git config --add -f .gitmodules submodule.subname.path sm &&
941 git config --add submodule.subname.ignore dirty &&
942 git config --add submodule.subname.path sm &&
961 - git status > output &&
962 - test_cmp expect output &&
943 + git status >output &&
944 + test_i18ncmp expect output &&
945 git config --remove-section submodule.subname &&
946 git config -f .gitmodules --remove-section submodule.subname
947 '
@@ -996,26 +978,26 @@ cat > expect << EOF
978 # untracked
979 EOF
980
999 -test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
981 +test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
982 git status --ignore-submodules=untracked > output &&
1001 - test_cmp expect output
983 + test_i18ncmp expect output
984 '
985
1004 -test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
986 +test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
987 git config --add -f .gitmodules submodule.subname.ignore untracked &&
988 git config --add -f .gitmodules submodule.subname.path sm &&
1007 - git status > output &&
1008 - test_cmp expect output &&
989 + git status >output &&
990 + test_i18ncmp expect output &&
991 git config -f .gitmodules --remove-section submodule.subname
992 '
993
1012 -test_expect_success C_LOCALE_OUTPUT ".git/config ignore=untracked doesn't suppress submodules with modified content" '
994 +test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
995 git config --add -f .gitmodules submodule.subname.ignore none &&
996 git config --add -f .gitmodules submodule.subname.path sm &&
997 git config --add submodule.subname.ignore untracked &&
998 git config --add submodule.subname.path sm &&
1017 - git status > output &&
1018 - test_cmp expect output &&
999 + git status >output &&
1000 + test_i18ncmp expect output &&
1001 git config --remove-section submodule.subname &&
1002 git config -f .gitmodules --remove-section submodule.subname
1003 '
@@ -1058,49 +1040,49 @@ cat > expect << EOF
1040 # untracked
1041 EOF
1042
1061 -test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodule summary" '
1043 +test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
1044 git status --ignore-submodules=untracked > output &&
1063 - test_cmp expect output
1045 + test_i18ncmp expect output
1046 '
1047
1066 -test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=untracked doesn't suppress submodule summary" '
1048 +test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
1049 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1050 git config --add -f .gitmodules submodule.subname.path sm &&
1069 - git status > output &&
1070 - test_cmp expect output &&
1051 + git status >output &&
1052 + test_i18ncmp expect output &&
1053 git config -f .gitmodules --remove-section submodule.subname
1054 '
1055
1074 -test_expect_success C_LOCALE_OUTPUT ".git/config ignore=untracked doesn't suppress submodule summary" '
1056 +test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
1057 git config --add -f .gitmodules submodule.subname.ignore none &&
1058 git config --add -f .gitmodules submodule.subname.path sm &&
1059 git config --add submodule.subname.ignore untracked &&
1060 git config --add submodule.subname.path sm &&
1079 - git status > output &&
1080 - test_cmp expect output &&
1061 + git status >output &&
1062 + test_i18ncmp expect output &&
1063 git config --remove-section submodule.subname &&
1064 git config -f .gitmodules --remove-section submodule.subname
1065 '
1066
1085 -test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=dirty doesn't suppress submodule summary" '
1067 +test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
1068 git status --ignore-submodules=dirty > output &&
1087 - test_cmp expect output
1069 + test_i18ncmp expect output
1070 '
1089 -test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=dirty doesn't suppress submodule summary" '
1071 +test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
1072 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1073 git config --add -f .gitmodules submodule.subname.path sm &&
1092 - git status > output &&
1093 - test_cmp expect output &&
1074 + git status >output &&
1075 + test_i18ncmp expect output &&
1076 git config -f .gitmodules --remove-section submodule.subname
1077 '
1078
1097 -test_expect_success C_LOCALE_OUTPUT ".git/config ignore=dirty doesn't suppress submodule summary" '
1079 +test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
1080 git config --add -f .gitmodules submodule.subname.ignore none &&
1081 git config --add -f .gitmodules submodule.subname.path sm &&
1082 git config --add submodule.subname.ignore dirty &&
1083 git config --add submodule.subname.path sm &&
1102 - git status > output &&
1103 - test_cmp expect output &&
1084 + git status >output &&
1085 + test_i18ncmp expect output &&
1086 git config --remove-section submodule.subname &&
1087 git config -f .gitmodules --remove-section submodule.subname
1088 '
@@ -1126,9 +1108,9 @@ cat > expect << EOF
1108 no changes added to commit (use "git add" and/or "git commit -a")
1109 EOF
1110
1129 -test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=all suppresses submodule summary" '
1111 +test_expect_success "--ignore-submodules=all suppresses submodule summary" '
1112 git status --ignore-submodules=all > output &&
1131 - test_cmp expect output
1113 + test_i18ncmp expect output
1114 '
1115
1116 test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '