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

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 UTC