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

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

From: Aryeh Gregor <Simetrical+w3c@gmail.com>
Date: Sun, 3 Apr 2011 14:14:15 -0400
Message-ID: <BANLkTimzPOuMA9NQcBCV1n3240qUUNWEhg@mail.gmail.com>
To: Ms2ger <ms2ger@gmail.com>
Cc: public-html-testsuite@w3.org
On Sat, Apr 2, 2011 at 11:25 AM, Ms2ger <ms2ger@gmail.com> wrote:
> function stringRep(val) { ... }
>
> Could you expose format_value in testharness.js and use that instead?

Done, in r310 (37873a35a41b).

> 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).

Oops, that was unintended.  I fixed it (also in r310), and hopefully
made the code clearer at the same time.

> 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.

The current WebIDL spec says JS value -> DOMString is just calling
ToString() (which is the same as String(), right?), if there are no
special flags being used:

http://dev.w3.org/2006/webapi/WebIDL/#es-DOMString

This is wrong as far as null goes, but the spec doesn't say that yet,
so I avoided testing null.  When WebIDL is fixed, we can fix the
tests, but otherwise we'd be testing something contrary to the spec.

> No other comments, test approved.

Thanks.
Received on Sunday, 3 April 2011 18:15:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 3 April 2011 18:15:07 GMT