js/src/tests/ecma/extensions/errorcolumnblame.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /*
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/licenses/publicdomain/
     4  */
     6 var BUGNUMBER = 568142;
     7 var summary = 'error reporting blames column as well as line';
     9 function test(f, col) {
    10     var caught = false;
    11     try {
    12         f();
    13     } catch (e) {
    14         caught = true;
    15         assertEq(e.columnNumber, col);
    16     }
    17     assertEq(caught, true);
    18 }
    20 /* Note single hard tab before return! */
    21 function foo(o) {
    22 	return o.p;
    23 }
    24 test(foo, 1);
    26 //234567890123456789
    27 test(function(f) { return f.bar; }, 19);
    28 test(function(f) { return f(); }, 19);
    29 /* Cover negative colspan case using for(;;) loop with error in update part. */
    30 test(function(){
    31         //0         1         2         3         4
    32         //012345678901234567890123456789012345678901
    33     eval("function baz() { for (var i = 0; i < 10; i += a.b); assertEq(i !== i, true); }");
    34     baz();
    35 }, 41);
    37 //        1         2         3
    38 //234567890123456789012345678901234
    39 test(function() { var tmp = null; tmp(); }, 34)
    40 test(function() { var tmp = null;  tmp.foo; }, 35)
    42 /* Just a generic 'throw'. */
    43 test(function() {
    44 //234567890123
    45     foo({}); throw new Error('a');
    46 }, 13);
    48 /* Be sure to report the right statement */
    49 test(function() {
    50     function f() { return true; }
    51     function g() { return false; }
    52 //234567890123456789012345678
    53     f(); g(); f(); if (f()) a += e;
    54 }, 28);
    56 //2345678901234567890
    57 test(function() { e++; }, 18);
    58 test(function() {print += e; }, 17);
    59 test(function(){e += 1 }, 16);
    60 test(function() {  print[e]; }, 19);
    61 test(function() { e[1]; }, 18);
    62 test(function() { e(); }, 18);
    63 test(function() { 1(); }, 18);
    64 test(function() { Object.defineProperty() }, 18);
    66 test(function() {
    67 //23456789012345678901
    68     function foo() { asdf; } foo()
    69 }, 21);
    71 reportCompare(0, 0, "ok");
    73 printStatus("All tests passed!");

mercurial