Hi,
Here is the patch below. Any question, pls let me know,
thanks.
--- /home/spring/perl/perl-current/ext/Hash/Util/t/Util.t
2006-06-27
01:21:57.000000000 +0800
+++ /home/spring/patch/chgfile/ext-Hash-Util-t-Util.t
2007-09-10
10:07:14.000000000 +0800
 -402,7
+402,12 
my legal=sort(legal_keys(%hash));
my keys=sort(keys(%hash));
is(" hidden","a b c d e
f",'lock_keys() hidden DDS/t 3');
- is(" legal","0 2 4 6 8 a b c d e
f",'lock_keys() legal DDS/t 3');
+ if (ord("A") == 193) {
+ is(" legal","a b c d e f 0 2 4 6
8",'lock_keys() legal DDS/t
3');
+ }
+ else {
+ is(" legal","0 2 4 6 8 a b c d e
f",'lock_keys() legal DDS/t
3');
+ }
is(" keys","0 2 4 6
8",'lock_keys() keys');
}
{
 -427,7
+432,12 
my legal=sort(legal_keys(%hash));
my keys=sort(keys(%hash));
is(" hidden","a b c d e
f",'lock_ref_keys() hidden DDS/t 2');
- is(" legal","0 2 4 6 8 a b c d e
f",'lock_ref_keys() legal DDS/t
2');
+ if (ord("A") == 193) {
+ is(" legal","a b c d e f 0 2 4 6
8",'lock_ref_keys() legal DDS/t
2');
+ }
+ else {
+ is(" legal","0 2 4 6 8 a b c d e
f",'lock_ref_keys() legal DDS/t
2');
+ }
is(" keys","0 2 4 6
8",'lock_ref_keys() keys DDS/t 2');
}
{
 -438,7
+448,12 
my legal=sort(legal_keys(%hash));
my keys=sort(keys(%hash));
is(" hidden","a b c d e
f",'lock_ref_keys_plus() hidden DDS/t');
- is(" legal","0 2 4 6 8 a b c d e
f",'lock_ref_keys_plus() legal
DDS/t');
+ if (ord("A") == 193) {
+ is(" legal","a b c d e f 0 2 4 6
8",'lock_ref_keys_plus() legal
DDS/t');
+ }
+ else {
+ is(" legal","0 2 4 6 8 a b c d e
f",'lock_ref_keys_plus() legal
DDS/t');
+ }
is(" keys","0 2 4 6
8",'lock_ref_keys_plus() keys DDS/t');
}
{
 -449,7
+464,12 
my legal=sort(legal_keys(%hash));
my keys=sort(keys(%hash));
is(" hidden","a b c d e
f",'lock_keys_plus() hidden DDS/t 3');
- is(" legal","0 2 4 6 8 a b c d e
f",'lock_keys_plus() legal DDS/t
3');
+ if (ord("A") == 193) {
+ is(" legal","a b c d e f 0 2 4 6
8",'lock_keys_plus() legal
DDS/t 3');
+ }
+ else {
+ is(" legal","0 2 4 6 8 a b c d e
f",'lock_keys_plus() legal
DDS/t 3');
+ }
is(" keys","0 2 4 6
8",'lock_keys_plus() keys DDS/t 3');
}
Ge, Chun Bing
空山新雨后,天气晚来秋
|
Chun Bing Ge wrote:
> Here is the patch below. Any question, pls let me know,
thanks.
Hi, thanks for the patches. I have a suggestion for a
better way to write
them. As it stands right now,
it's duplicating a lot of code. All of these differences
appear to be because
of the way sort() works
with no sort routine...
sort array;
Normally it's ASCIIbetical but for you it's EBCIDICical.
Rather than change all the expected outputs in the tests, it
would be better
to make the sort routine explicit...
sort { $a cmp $b } array;
which I assume will act the same on ASCII and EBCIDIC
platforms. Then no
duplication of the expected output is necessary and no magic
"if( ord('A') )"
blocks either.
For example, the code below would become...
{
my %hash=(0..9);
lock_keys(%hash,keys(%hash),'a'..'f');
ok(Internals::SvREADONLY(%hash),'lock_keys args
DDS/t');
my hidden = sort { $a cmp $b } hidden_keys(%hash);
my legal = sort { $a cmp $b } legal_keys(%hash);
my keys = sort { $a cmp $b } keys(%hash);
is(" hidden", "a b c d e f",
'lock_keys() hidden DDS/t 3');
is(" legal", "0 2 4 6 8 a b c d e
f", 'lock_keys() legal DDS/t 3');
is(" keys", "0 2 4 6 8",
'lock_keys() keys');
}
That should work fine on both ASCII and EBCIDIC.
This technique can be applied to all your recent patches.
> ---
/home/spring/perl/perl-current/ext/Hash/Util/t/Util.t
2006-06-27
> 01:21:57.000000000 +0800
> +++ /home/spring/patch/chgfile/ext-Hash-Util-t-Util.t
2007-09-10
> 10:07:14.000000000 +0800
>  -402,7 +402,12 
> my legal=sort(legal_keys(%hash));
> my keys=sort(keys(%hash));
> is(" hidden","a b c d e
f",'lock_keys() hidden DDS/t 3');
> - is(" legal","0 2 4 6 8 a b c d e
f",'lock_keys() legal DDS/t 3');
> + if (ord("A") == 193) {
> + is(" legal","a b c d e f 0 2 4 6
8",'lock_keys() legal DDS/t
> 3');
> + }
> + else {
> + is(" legal","0 2 4 6 8 a b c d e
f",'lock_keys() legal DDS/t
> 3');
> + }
> is(" keys","0 2 4 6
8",'lock_keys() keys');
> }
--
Life is like a sewer - what you get out of it depends on
what you put into it.
- Tom Lehrer
|