Merge branch 'dn/test-reject-utf-16'
authorJunio C Hamano <gitster@pobox.com>
Mon, 5 Aug 2013 17:11:10 +0000 (10:11 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 5 Aug 2013 17:11:10 +0000 (10:11 -0700)
* dn/test-reject-utf-16:
t3900: test rejecting log message with NULs correctly
Add missing test file for UTF-16.

1  2 
t/t3900-i18n-commit.sh
index 38b00c37b0606a5442f2dce02647a019f0c80c9e,a9e56629d8578701b14e1a8919a317648ddbbcc0..4bf1dbe9c9f3ffeb1151be07bf75dcd872167916
@@@ -34,47 -34,11 +34,47 @@@ test_expect_success 'no encoding heade
        test z = "z$E"
  '
  
- test_expect_failure 'UTF-16 refused because of NULs' '
+ test_expect_success 'UTF-16 refused because of NULs' '
        echo UTF-16 >F &&
-       git commit -a -F "$TEST_DIRECTORY"/t3900/UTF-16.txt
+       test_must_fail git commit -a -F "$TEST_DIRECTORY"/t3900/UTF-16.txt
  '
  
 +test_expect_success 'UTF-8 invalid characters refused' '
 +      test_when_finished "rm -f $HOME/stderr $HOME/invalid" &&
 +      echo "UTF-8 characters" >F &&
 +      printf "Commit message\n\nInvalid surrogate:\355\240\200\n" \
 +              >"$HOME/invalid" &&
 +      git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
 +      grep "did not conform" "$HOME"/stderr
 +'
 +
 +test_expect_success 'UTF-8 overlong sequences rejected' '
 +      test_when_finished "rm -f $HOME/stderr $HOME/invalid" &&
 +      rm -f "$HOME/stderr" "$HOME/invalid" &&
 +      echo "UTF-8 overlong" >F &&
 +      printf "\340\202\251ommit message\n\nThis is not a space:\300\240\n" \
 +              >"$HOME/invalid" &&
 +      git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
 +      grep "did not conform" "$HOME"/stderr
 +'
 +
 +test_expect_success 'UTF-8 non-characters refused' '
 +      test_when_finished "rm -f $HOME/stderr $HOME/invalid" &&
 +      echo "UTF-8 non-character 1" >F &&
 +      printf "Commit message\n\nNon-character:\364\217\277\276\n" \
 +              >"$HOME/invalid" &&
 +      git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
 +      grep "did not conform" "$HOME"/stderr
 +'
 +
 +test_expect_success 'UTF-8 non-characters refused' '
 +      test_when_finished "rm -f $HOME/stderr $HOME/invalid" &&
 +      echo "UTF-8 non-character 2." >F &&
 +      printf "Commit message\n\nNon-character:\357\267\220\n" \
 +              >"$HOME/invalid" &&
 +      git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
 +      grep "did not conform" "$HOME"/stderr
 +'
  
  for H in ISO8859-1 eucJP ISO-2022-JP
  do