js/src/jit-test/tests/debug/Environment-find-04.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/debug/Environment-find-04.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,21 @@
     1.4 +// env.find throws a TypeError if the argument is not an identifier.
     1.5 +
     1.6 +load(libdir + "asserts.js");
     1.7 +
     1.8 +var g = newGlobal();
     1.9 +var dbg = Debugger(g);
    1.10 +var hits = 0;
    1.11 +g.h = function () {
    1.12 +    var env = dbg.getNewestFrame().environment;
    1.13 +    assertThrowsInstanceOf(function () { env.find(); }, TypeError);
    1.14 +    assertThrowsInstanceOf(function () { env.find(""); }, TypeError);
    1.15 +    assertThrowsInstanceOf(function () { env.find(" "); }, TypeError);
    1.16 +    assertThrowsInstanceOf(function () { env.find(0); }, TypeError);
    1.17 +    assertThrowsInstanceOf(function () { env.find("0"); }, TypeError);
    1.18 +    assertThrowsInstanceOf(function () { env.find("0xc"); }, TypeError);
    1.19 +    assertThrowsInstanceOf(function () { env.find("Anna Karenina"); }, TypeError);
    1.20 +    hits++;
    1.21 +};
    1.22 +g.eval("h();");
    1.23 +g.eval("with ([1]) h();");
    1.24 +assertEq(hits, 2);

mercurial