diff --git a/testing/xpcshell/head.js b/testing/xpcshell/head.js index 6c146aa4aee..7ae96501578 100644 --- a/testing/xpcshell/head.js +++ b/testing/xpcshell/head.js @@ -723,6 +723,9 @@ function todo_check_neq(left, right, stack) { } function do_report_result(passed, text, stack, todo) { + while (stack.filename.contains("head.js") && stack.caller) { + stack = stack.caller; + } if (passed) { if (todo) { do_throw_todo(text, stack); diff --git a/testing/xpcshell/selftest.py b/testing/xpcshell/selftest.py index 64c6207a580..959d6015cbd 100644 --- a/testing/xpcshell/selftest.py +++ b/testing/xpcshell/selftest.py @@ -537,6 +537,19 @@ tail = self.assertEquals(1, self.x.passCount) self.assertEquals(0, self.x.failCount) + def testLogCorrectFileName(self): + """ + Make sure a meaningful filename and line number is logged + by a passing test. + """ + self.writeFile("test_add_test_simple.js", ADD_TEST_SIMPLE) + self.writeManifest(["test_add_test_simple.js"]) + + self.assertTestResult(True, verbose=True) + self.assertInLog("true == true") + self.assertNotInLog("[do_check_true :") + self.assertInLog("[test_simple : 5]") + def testAddTestFailing(self): """ Ensure add_test() with a failing test is reported.