Fixed the issue that t/12-cache.t was not able to run in MS-Win32, due to missing binmode on file I/O, where MS-Win32 behaves differently with Linux on text file I/O.

This commit is contained in:
依瑪貓 2019-09-17 00:57:05 +08:00
parent b3bce9147e
commit 124281b941
2 changed files with 9 additions and 5 deletions

View File

@ -42,7 +42,7 @@ SHA1 a4491ef77b899c4988b8ab34fb8f945a8d06c285 t/08-f-errors.t
SHA1 8fb7ecbce36daaf81ac9c197dab6834b25233cc5 t/09-f-encodings.t SHA1 8fb7ecbce36daaf81ac9c197dab6834b25233cc5 t/09-f-encodings.t
SHA1 2c1641cc6fff792fb83826486050acab23a1db51 t/10-f-switching.t SHA1 2c1641cc6fff792fb83826486050acab23a1db51 t/10-f-switching.t
SHA1 4afe4980e7ed4d326009b8257e01320abfb33d14 t/11-command-line.t SHA1 4afe4980e7ed4d326009b8257e01320abfb33d14 t/11-command-line.t
SHA1 a79a59f283d0f4cbac868443a34aa132c38a357d t/12-cache.t SHA1 ed15cbcfbfb59b23465427cda4f1373de973b347 t/12-cache.t
SHA1 b85626024d610808bd0909989dcfb9fb20a40485 t/99-pod.t SHA1 b85626024d610808bd0909989dcfb9fb20a40485 t/99-pod.t
SHA1 97dad77dee7f751d09efdb6900b077d68c853d46 t/T_L10N.pm SHA1 97dad77dee7f751d09efdb6900b077d68c853d46 t/T_L10N.pm
SHA1 676b87d7a8edc735ba676d2901827eb52532b418 t/locale/C/LC_MESSAGES/test.mo SHA1 676b87d7a8edc735ba676d2901827eb52532b418 t/locale/C/LC_MESSAGES/test.mo
@ -60,7 +60,7 @@ SHA1 20f810c6229d0bd4064b27f9b3d86b61a20f0821 t/locale/zh_TW/LC_MESSAGES/test_be
SHA1 eb13887b005e3c3e9fab774dfea22de5c01ad1ef t/locale/zh_TW/LC_MESSAGES/test_utf8.mo SHA1 eb13887b005e3c3e9fab774dfea22de5c01ad1ef t/locale/zh_TW/LC_MESSAGES/test_utf8.mo
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
iF0EARECAB0WIQSBin4eTeP7OclnnAOL2C5vMLlLXAUCXXZi2AAKCRCL2C5vMLlL iF0EARECAB0WIQSBin4eTeP7OclnnAOL2C5vMLlLXAUCXX++3QAKCRCL2C5vMLlL
XGjsAJ4uek7Y/xxMkGmuHZ1UXhAWWoxMBACffY/hG/seBDmCFrCsJWeZ4DpFhYI= XBi2AJ9m0sI8fh92zdfUT8pMnpeEZzDOIACgg/oNq/wgMJM+2OfX4tuXsJIZEhU=
=cRCX =RtGU
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----

View File

@ -26,11 +26,14 @@ $r = eval {
$mo_file1 = catfile($LOCALEDIR, "en", "LC_MESSAGES", "test-cache.mo"); $mo_file1 = catfile($LOCALEDIR, "en", "LC_MESSAGES", "test-cache.mo");
($atime, $mtime0, $size) = (stat $mo_file0)[8,9,7]; ($atime, $mtime0, $size) = (stat $mo_file0)[8,9,7];
open $FH, $mo_file0 or die "$mo_file0: $!"; open $FH, $mo_file0 or die "$mo_file0: $!";
binmode $FH or die "$mo_file0: $!";
read $FH, $content, $size or die "$mo_file0: $!"; read $FH, $content, $size or die "$mo_file0: $!";
close $FH or die "$mo_file0: $!"; close $FH or die "$mo_file0: $!";
open $FH, ">$mo_file1" or die "$mo_file1: $!"; open $FH, ">$mo_file1" or die "$mo_file1: $!";
binmode $FH or die "$mo_file1: $!";
print $FH $content or die "$mo_file1: $!"; print $FH $content or die "$mo_file1: $!";
close $FH or die "$mo_file1: $!"; close $FH or die "$mo_file1: $!";
$mtime1 = (stat $mo_file1)[9];
utime $atime, $mtime0, $mo_file1 or die "$mo_file1: $!"; utime $atime, $mtime0, $mo_file1 or die "$mo_file1: $!";
require T_L10N; require T_L10N;
@ -39,15 +42,16 @@ $r = eval {
$_->bindtextdomain("test-cache", $LOCALEDIR); $_->bindtextdomain("test-cache", $LOCALEDIR);
$_->textdomain("test-cache"); $_->textdomain("test-cache");
$_[0] = $_->maketext("Hello, world!"); $_[0] = $_->maketext("Hello, world!");
my %Lexicon = %{$_->{"Lexicon"}};
# Update the file but keep the size and mtime # Update the file but keep the size and mtime
open $FH, "+<$mo_file1" or die "$mo_file1: $!"; open $FH, "+<$mo_file1" or die "$mo_file1: $!";
binmode $FH or die "$mo_file1: $!";
read $FH, $content, $size or die "$mo_file1: $!"; read $FH, $content, $size or die "$mo_file1: $!";
$content =~ s/Hiya/HiYa/; $content =~ s/Hiya/HiYa/;
seek $FH, 0, 0 or die "$mo_file1: $!"; seek $FH, 0, 0 or die "$mo_file1: $!";
print $FH $content or die "$mo_file1: $!"; print $FH $content or die "$mo_file1: $!";
close $FH or die "$mo_file1: $!"; close $FH or die "$mo_file1: $!";
($mtime1, $size) = (stat $mo_file1)[9,7];
utime $atime, $mtime0, $mo_file1 or die "$mo_file1: $!"; utime $atime, $mtime0, $mo_file1 or die "$mo_file1: $!";
$_->textdomain("test-cache"); $_->textdomain("test-cache");
$_[1] = $_->maketext("Hello, world!"); $_[1] = $_->maketext("Hello, world!");