Unit Testing, Testing for Missing "var"s.

49 views
Skip to first unread message

Kris Kowal

unread,
Oct 3, 2009, 2:11:08 PM10/3/09
to comm...@googlegroups.com
Under point 10 of Unit_Testing/A, there's a note that we need to
discuss how implementations are supposed to grab the global object to
verify that missing vars do not modify the global scope.

> 10. The addsGlobals flag must suppress the test runner from failing
> any test that adds a property to the global object. Otherwise, the test
> runner may make this check to spot likely missing var declarations.

In some environments it will be sufficient that the global object is
frozen or inaccessible, thus missing vars will throw errors
automatically. In other cases, there may be non-standard ways of
getting the global object. But the wording here is very careful to
avoid the issue and leave that to implementors since it does not
require implementations of the test runner module to verify missing
var, it only requires the test runner to suppress deliberate checking
for test cases marked with the "addsGlobals" flag.

In any case, I'd like to close this issue with a quick show of hands:
A. remove point 10
B. revise 10 to require globals to be checked regardless
C. revise 10 to disallow global checks
D. leave 10 as it stands now

Kris Kowal

Ash Berlin

unread,
Oct 3, 2009, 2:24:09 PM10/3/09
to comm...@googlegroups.com


My comments in my previous mail were going to be:

point 10) (addGlobal) seems ... ill specified. When would this check
happen? Also the wording implies its should do this check by default?
In flusspferd you get a warning if you assign to something without
declaring a var for it. Also this sort of check isn't easy to
implement. I guess its a 'may' so that I can just ignore this
behaviour :)

I'm against B quite strongly, since flusspferd has warnings (could be
errors) for this.

A: +1, D: +0.1 (we operate STV right?)

Wes Garland

unread,
Oct 4, 2009, 7:50:52 AM10/4/09
to comm...@googlegroups.com
On Sat, Oct 3, 2009 at 2:24 PM, Ash Berlin <ash_flu...@firemirror.com> wrote:
I'm against B quite strongly, since flusspferd has warnings (could be
errors) for this.

A: +1, D: +0.1 (we operate STV right?)


And it should be pointed out that flusspferd's warnings (and gpsee's warnings) come from JSOPTIONS_STRICT, which is the spidermonkey precursor to ES5 "use strict".

Wes
 
--
Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102

Hannes Wallnoefer

unread,
Oct 4, 2009, 8:28:50 AM10/4/09
to comm...@googlegroups.com
2009/10/4 Wes Garland <w...@page.ca>:
>
>
> On Sat, Oct 3, 2009 at 2:24 PM, Ash Berlin <ash_flu...@firemirror.com>
> wrote:
>>
>> I'm against B quite strongly, since flusspferd has warnings (could be
>> errors) for this.
>>
>> A: +1, D: +0.1 (we operate STV right?)
>>
>
> And it should be pointed out that flusspferd's warnings (and gpsee's
> warnings) come from JSOPTIONS_STRICT, which is the spidermonkey precursor to
> ES5 "use strict".

This feature is also available in Rhino (via
Context.FEATURE_STRICT_VARS) and I enabled it recently in Helma NG. It
can be enabled in the Rhino shell using the -strict command line
option.

So I guess at least for Mozilla based engines, missing var detection
might not be a high priority item for unit testing.

Hannes

Kris Kowal

unread,
Oct 4, 2009, 8:38:44 AM10/4/09
to comm...@googlegroups.com
On Sun, Oct 4, 2009 at 5:28 AM, Hannes Wallnoefer <han...@gmail.com> wrote:
> So I guess at least for Mozilla based engines, missing var detection
> might not be a high priority item for unit testing.

I've removed mention of addsGlobals.

Kris Kowal

Reply all
Reply to author
Forward
0 new messages