X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fcrypt.t;h=27c878f1bd5d3a01f512ba3df917201cc621aefa;hb=b36bdecab13f885c556206f71bfc47083b33107e;hp=8beb41d498de752fff2465e3f62d8a3f4a8c8703;hpb=69026470e9d2e2c7bf7b03f351d6e98a6d6f29f3;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/crypt.t b/t/op/crypt.t index 8beb41d..27c878f 100644 --- a/t/op/crypt.t +++ b/t/op/crypt.t @@ -14,7 +14,7 @@ BEGIN { skip_all("crypt unimplemented"); } else { - plan(tests => 2); + plan(tests => 4); } } @@ -28,6 +28,19 @@ BEGIN { # bets, given alternative encryption/hashing schemes like MD5, # C2 (or higher) security schemes, and non-UNIX platforms. -ok(substr(crypt("ab", "cd"), 2) ne substr(crypt("ab", "ce"), 2), "salt makes a difference"); +SKIP: { + skip ("VOS crypt ignores salt.", 1) if ($^O eq 'vos'); + ok(substr(crypt("ab", "cd"), 2) ne substr(crypt("ab", "ce"), 2), "salt makes a difference"); +} + +$a = "a\xFF\x{100}"; + +eval {$b = crypt($a, "cd")}; +like($@, qr/Wide character in crypt/, "wide characters ungood"); + +chop $a; # throw away the wide character + +eval {$b = crypt($a, "cd")}; +is($@, '', "downgrade to eight bit characters"); +is($b, crypt("a\xFF", "cd"), "downgrade results agree"); -ok(crypt("HI", "HO") eq crypt(join("",map{chr($_+256)}unpack"C*","HI"), "HO"), "low eight bits of Unicode");