diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-05-09 12:03:32 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-05-09 12:03:32 +0000 |
commit | 564490341f966f7b0c1bda41fca4cb8e36536419 (patch) | |
tree | 233a0cb1c6aa3a5c6cdeb432d5261880cfe23120 /perl_checker.src/test | |
parent | 4c722bf569ca23760269c2a4ed147d047398288a (diff) | |
download | perl-MDK-Common-564490341f966f7b0c1bda41fca4cb8e36536419.tar perl-MDK-Common-564490341f966f7b0c1bda41fca4cb8e36536419.tar.gz perl-MDK-Common-564490341f966f7b0c1bda41fca4cb8e36536419.tar.bz2 perl-MDK-Common-564490341f966f7b0c1bda41fca4cb8e36536419.tar.xz perl-MDK-Common-564490341f966f7b0c1bda41fca4cb8e36536419.zip |
finishing context checks cleanup
Diffstat (limited to 'perl_checker.src/test')
-rw-r--r-- | perl_checker.src/test/context.t | 18 | ||||
-rw-r--r-- | perl_checker.src/test/suggest_better.t | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/perl_checker.src/test/context.t b/perl_checker.src/test/context.t index c0bc221..637360e 100644 --- a/perl_checker.src/test/context.t +++ b/perl_checker.src/test/context.t @@ -13,9 +13,25 @@ length @l never use "length @l", it returns the l 'xxx' > 'yyy' context string is not compatible with context float context string is not compatible with context float - you should use a string operator, not the number operator ">" + 1 cmp 2 you should use a number operator, not the string operator "cmp" (or replace the number with a string) $xxx == undef context undef is not compatible with context float +my ($xxx) = 1 context int is not compatible with context tuple(scalar) + +($xxx, $yyy) = 1 context int is not compatible with context tuple(scalar, scalar) + +($xxx, $yyy) = (1, 2, 3) context tuple(int, int, int) is not compatible with context tuple(scalar, scalar) + +@l eq '3' context array is not compatible with context string + +qw(a b) > 2 context tuple(string, string) is not compatible with context float + +%h > 0 context hash is not compatible with context float + +%h eq 0 context hash is not compatible with context string + you should use a number operator, not the string operator "eq" (or replace the number with a string) + +@l == () diff --git a/perl_checker.src/test/suggest_better.t b/perl_checker.src/test/suggest_better.t index 865ace8..58a1308 100644 --- a/perl_checker.src/test/suggest_better.t +++ b/perl_checker.src/test/suggest_better.t @@ -54,6 +54,8 @@ my @l = (); no need to initialize variables, it's d $l[$#l] you can replace $#l with -1 +$#l == 0 $#x == 0 is better written @x == 1 + xxx(@_) replace xxx(@_) with &xxx member($xxx, keys %h) you can replace "member($xxx, keys %yyy)" with "exists $yyy{$xxx}" |