LiTiang / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

assetException on Iterator. #155

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Enable <script type="text/javascript;version=1.7" ...
2. Add TestCase("Only 1.7", {
 "test Iterator on object property": function() {
            var obj = {name:"Jack Bauer",
                       username:"JackB",
                       id:12345,
                       agency:"CTU",  
                       region:"Los Angeles"};  

            for (let[prop, val] in Iterator(obj)) {
                // repl.print (prop + " = " + val);
                assertEquals(obj[prop], val);
            }

            var it = Iterator(obj, true);  

            assertException(function() {
                while (true) it.next();
            }, StopIteration);
 }});

Expected output: 
> Fails: 0; Errors: 0
Got output:
> expected to throw [object StopIteration] but threw undefined

Using JsTestDriver-1.2.2-src.jar version with Mozilla/5.0 (X11; U; Linux i686; 
en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12

Code snippet taken from:
https://developer.mozilla.org/en/new_in_javascript_1.7

In Gecko, StopIteration.name property is missing.

Workaround in Asserts.js:378
//    if (error && e.name != error) {
      if (! e instanceof error) {

where error StopIteration.

Original issue reported on code.google.com by lib.aca...@gmail.com on 1 Nov 2010 at 9:40