Bug 982852 - Add failing cases to selftest.py when run_test() is not present; r=gps

Since the simple test cases before this bug had cases for both passing and
failing, it would be a good idea to follow suit and add similar failing tests
for when run_test() is omitted.

Like the other simple tests defined in selftest.py, SIMPLE_FAILING_TEST,
ADD_TEST_FAILING, etc., it follows a similar pattern except these are done
without run_test() defined.

--HG--
extra : rebase_source : a1ef9a7b9e8274fe981864c5e021c80d2d66f7ec
This commit is contained in:
Krishnashish Gogoi 2015-04-03 02:12:30 +05:30
Родитель bf13167dea
Коммит 969ba3e8a7
1 изменённых файлов: 41 добавлений и 0 удалений

Просмотреть файл

@ -320,6 +320,19 @@ NO_RUN_TEST_EMPTY_TEST = '''
// This is an empty test file.
'''
NO_RUN_TEST_ADD_TEST_FAIL = '''
add_test(function no_run_test_add_test_fail() {
do_check_true(false);
run_next_test();
});
'''
NO_RUN_TEST_ADD_TASK_FAIL = '''
add_task(function no_run_test_add_task_fail() {
do_check_true(false);
});
'''
class XPCShellTestsTests(unittest.TestCase):
"""
@ -983,5 +996,33 @@ tail =
self.assertInLog(TEST_PASS_STRING)
self.assertNotInLog(TEST_FAIL_STRING)
def testNoRunTestAddTestFail(self):
"""
Check that test fails on using add_test() without run_test().
"""
self.writeFile("test_noRunTestAddTestFail.js", NO_RUN_TEST_ADD_TEST_FAIL)
self.writeManifest(["test_noRunTestAddTestFail.js"])
self.assertTestResult(False)
self.assertEquals(1, self.x.testCount)
self.assertEquals(0, self.x.passCount)
self.assertEquals(1, self.x.failCount)
self.assertInLog(TEST_FAIL_STRING)
self.assertNotInLog(TEST_PASS_STRING)
def testNoRunTestAddTaskFail(self):
"""
Check that test fails on using add_task() without run_test().
"""
self.writeFile("test_noRunTestAddTaskFail.js", NO_RUN_TEST_ADD_TASK_FAIL)
self.writeManifest(["test_noRunTestAddTaskFail.js"])
self.assertTestResult(False)
self.assertEquals(1, self.x.testCount)
self.assertEquals(0, self.x.passCount)
self.assertEquals(1, self.x.failCount)
self.assertInLog(TEST_FAIL_STRING)
self.assertNotInLog(TEST_PASS_STRING)
if __name__ == "__main__":
unittest.main(verbosity=3)