Skip Menu |
 
Report information
Id: 70415
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] Using Parrot's Digest feature on a Str coming out of Str.split works differently from a Str that doesn't in Rakudo
Date: Thu, 12 Nov 2009 00:10:33 +0100
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 640b
$ cat bug sub digest(Str $text) is export { my $binary = Q:PIR { .local string text .local pmc digest # Input $P0 = find_lex '$text' text = $P0 # Choose the right digest. $P1 = loadlib 'digest_group' digest = new 'SHA256' # Calculate the digest. digest.'Init'() digest.'Update'(text) $S0 = digest.'Final'() %r = box $S0 }; # Convert to hex. return [~] map { sprintf '%02x', .ord }, $binary.comb; } say digest('user_name=carl'.split("=")[1]); say digest('carl'); $ perl6 bug 04f8996da763b7a969b1028ee3007569eaf3a635486ddab211d512c85b9df8fb 69bfe1e6e44821df7f8a0927bd7e61ef208fdb25deaa4353450bc3fb904abd52
Download (untitled) / with headers
text/plain 231b
<moritz_> rakudo: say 'user_name=carl'.split("=")[1].PARROT <p6eval> rakudo 50e495: String␤ <moritz_> rakudo: say 'carl'.PARROT <p6eval> rakudo 50e495: Str␤ <moritz_> there you go. * masak adds moritz_'s discovery to the ticket
Fixed in f87efac027edf84bff2b8578a9762ac8ab8b44ca, jnthn++
Subject: [perl #70415] tests available
Date: Sat, 14 Nov 2009 13:50:04 -0600
To: perl6-bugs-followup [...] perl.org
From: kyleha [...] gmail.com
Download (untitled) / with headers
text/plain 1.3k
This is an automatically generated mail to inform you that tests are now available in t/spec/integration/real-strings.t commit b3197187a377336d0a0ce53ee22d1cc8b1136433 Author: moritz <moritz@c213334d-75ef-0310-aa23-eaa082d1ae64> Date: Sat Nov 14 19:47:08 2009 +0000 [t/spec] test for RT #70415, split() should return real strings git-svn-id: http://svn.pugscode.org/pugs@29087 c213334d-75ef-0310-aa23-eaa082d1ae64 diff --git a/t/spec/integration/real-strings.t b/t/spec/integration/real-strings.t index 5b14597..9707aee 100644 --- a/t/spec/integration/real-strings.t +++ b/t/spec/integration/real-strings.t @@ -1,6 +1,6 @@ use v6; use Test; -plan 11; +plan *; # Rakudo had a regression that # string returned from regexes were Parrot strings, not Perl 6 strings. @@ -20,6 +20,8 @@ plan 11; 'Still works with strings returned from split() (lives)'; is $x.trans(['a'] => ['b']), 'b', 'Still works with strings returned from split() (result)'; + $x = 'abc'.split('b').[0]; + is $x.trans(['a'] => ['b']), 'b', 'same for split(Str)'; } dies_ok { for "a b c".split(/\s/) -> $foo { $foo = $foo; } }, 'variables returned from split and passed to pointy block are still ro'; @@ -56,4 +58,6 @@ is "helo".lc.trans(("aeiou" => "AEIOU")), 'hElO', '.flip.trans (RT 66300)'; is $x, +%*VM.keys, '%*VM.kv is self-consistent'; } +done_testing; + # vim: ft=perl6


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org