michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: */ michael@0: michael@0: var BUGNUMBER = 568142; michael@0: var summary = 'error reporting blames column as well as line'; michael@0: michael@0: function test(f, col) { michael@0: var caught = false; michael@0: try { michael@0: f(); michael@0: } catch (e) { michael@0: caught = true; michael@0: assertEq(e.columnNumber, col); michael@0: } michael@0: assertEq(caught, true); michael@0: } michael@0: michael@0: /* Note single hard tab before return! */ michael@0: function foo(o) { michael@0: return o.p; michael@0: } michael@0: test(foo, 1); michael@0: michael@0: //234567890123456789 michael@0: test(function(f) { return f.bar; }, 19); michael@0: test(function(f) { return f(); }, 19); michael@0: /* Cover negative colspan case using for(;;) loop with error in update part. */ michael@0: test(function(){ michael@0: //0 1 2 3 4 michael@0: //012345678901234567890123456789012345678901 michael@0: eval("function baz() { for (var i = 0; i < 10; i += a.b); assertEq(i !== i, true); }"); michael@0: baz(); michael@0: }, 41); michael@0: michael@0: // 1 2 3 michael@0: //234567890123456789012345678901234 michael@0: test(function() { var tmp = null; tmp(); }, 34) michael@0: test(function() { var tmp = null; tmp.foo; }, 35) michael@0: michael@0: /* Just a generic 'throw'. */ michael@0: test(function() { michael@0: //234567890123 michael@0: foo({}); throw new Error('a'); michael@0: }, 13); michael@0: michael@0: /* Be sure to report the right statement */ michael@0: test(function() { michael@0: function f() { return true; } michael@0: function g() { return false; } michael@0: //234567890123456789012345678 michael@0: f(); g(); f(); if (f()) a += e; michael@0: }, 28); michael@0: michael@0: //2345678901234567890 michael@0: test(function() { e++; }, 18); michael@0: test(function() {print += e; }, 17); michael@0: test(function(){e += 1 }, 16); michael@0: test(function() { print[e]; }, 19); michael@0: test(function() { e[1]; }, 18); michael@0: test(function() { e(); }, 18); michael@0: test(function() { 1(); }, 18); michael@0: test(function() { Object.defineProperty() }, 18); michael@0: michael@0: test(function() { michael@0: //23456789012345678901 michael@0: function foo() { asdf; } foo() michael@0: }, 21); michael@0: michael@0: reportCompare(0, 0, "ok"); michael@0: michael@0: printStatus("All tests passed!");