W3C home > Mailing lists > Public > public-html-testsuite@w3.org > April 2011

Re: Request for approval of btoa()/atob() tests

From: Ms2ger <ms2ger@gmail.com>
Date: Sat, 02 Apr 2011 17:25:12 +0200
Message-ID: <4D973FD8.6050503@gmail.com>
To: Aryeh Gregor <Simetrical+w3c@gmail.com>
CC: public-html-testsuite@w3.org
On 02/09/2011 08:52 PM, Aryeh Gregor wrote:
> Tests:
>
> http://dvcs.w3.org/hg/html/raw-file/tip/tests/submission/AryehGregor/base64.html
>
> For recently-added spec text:
>
> http://dev.w3.org/html5/spec/webappapis.html#atob
>
> Review would be appreciated.

function stringRep(val) { ... }

Could you expose format_value in testharness.js and use that instead?

mybtoa:

     out += btoaLookup( ((s.charCodeAt(i) & 0x03) << 4) |
                         (s.charCodeAt(i + 1) >> 4) );
     if (i + 1 < s.length) {
       out += btoaLookup( ((s.charCodeAt(i + 1) & 0x0f) << 2) |
                           (s.charCodeAt(i + 2) >> 6) );
     } else {
       out += '=';
     }
     if (i + 2 < s.length) {
       out += btoaLookup(s.charCodeAt(i + 2) & 0x3f);
     } else {
       out += '=';
     }

I note that you're relying on s.charCodeAt(s.length) >> n === 0. It 
might be good to note that in a comment (or not do that).

I also note that you don't actually test JS value -> DOMString 
conversion, just that it matches String(), which will be a problem once 
you test null.

I haven't checked the supporting test code carefully.

No other comments, test approved.

Thanks
Ms2ger
Received on Saturday, 2 April 2011 15:25:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 2 April 2011 15:25:50 GMT