Cees Hek wrote:
On 4/28/06, Andrew Ford <[EMAIL PROTECTED]> wrote:
Andrew Ford wrote:
> BTW any thoughts on how to test the raw md5 and sha1 methods.  They
> return raw binary strings and I don't really want to include such
> strings as the expected output in my Template::Test data.  What is a
> relatively portable way to encode a binary string?
>
What I mean by this is that I want to have something like this in my
Template::Test test script:

    --test--
    [% USE Digest.MD5; text = 'xyzzy';  text.md5 | some_encoding; %]
    --expect--
    ??????????????

such that the code generates output that only consists of printable
ASCII characters that I can then specify in the expect part.

Any suggestions would be welcome.

You could double encode it.  Test the base64 methods first to make
sure that works,  and then test the binary one which also base64
encodes the message:

[% USE Digest.MD5; text = 'xyzzy';  text | md5 | md5_base64 %]

I like that idea and have put it into use in my test scripts. I'll upload the new versions to my website and to CPAN over the weekend.

Andrew

--
Andrew Ford, Director Pauntley Prints / Ford & Mason Ltd [EMAIL PROTECTED] South Wing Compton House pauntley-prints.co.uk Compton Green, Redmarley Tel: +44 1531 829900
ford-mason.co.uk          Gloucester GL19 3JB       Fax: +44 1531 829901
refcards.com cronolog.org Great Britain          Mobile: +44 7785 258278



_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to