Ejemplo n.º 1
0
    def test_summary_logfile(self):
        test_suite = test262.TestSuite(".",
                                       False,
                                       False,
                                       False,
                                       None)

        progress = test262.ProgressIndicator(100)
        progress.succeeded = 98
        progress.failed = 2

        fake_log = cStringIO.StringIO()
        test_suite.logf = fake_log

        result = mute(True)(test_suite.PrintSummary)(progress, True)

        expected_out = """
=== Summary ===
 - Ran 100 tests
 - Passed 98 tests (98.0%)
 - Failed 2 tests (2.0%)
"""

        expected_log = """=== Summary ===
 - Ran 100 tests
 - Passed 98 tests (98.0%)
 - Failed 2 tests (2.0%)
"""
        self.assertEqual(expected_out, result)
        self.assertEqual(expected_log, fake_log.getvalue())
Ejemplo n.º 2
0
 def test_create_test_suite(self):
     test_suite = test262.TestSuite(".",
                                    False,
                                    False,
                                    False,
                                    None)
     self.assertNotEqual(test_suite, None)
Ejemplo n.º 3
0
    def test_summary_withfails(self):
        test_suite = test262.TestSuite(".",
                                       False,
                                       False,
                                       False,
                                       None)

        progress = test262.ProgressIndicator(100)
        progress.succeeded = 98
        progress.failed = 2
        progress.failed_tests = [
            MockResult(MockTest("foo", False)),
            MockResult(MockTest("bar", True))
        ]

        result = mute(True)(test_suite.PrintSummary)(progress, None)
        self.assertEqual("""
=== Summary ===
 - Ran 100 tests
 - Passed 98 tests (98.0%)
 - Failed 2 tests (2.0%)

Failed Tests
  foo in non-strict mode

Expected to fail but passed ---
  bar in non-strict mode
""", result)
Ejemplo n.º 4
0
    def test_summary(self):
        test_suite = test262.TestSuite(".",
                                       False,
                                       False,
                                       False,
                                       None)

        progress = test262.ProgressIndicator(100)
        progress.succeeded = 98
        progress.failed = 2

        result = mute(True)(test_suite.PrintSummary)(progress, None)
        self.assertEqual("""
=== Summary ===
 - Ran 100 tests
 - Passed 98 tests (98.0%)
 - Failed 2 tests (2.0%)
""", result)
Ejemplo n.º 5
0
    def test_summary_withfails_andlog(self):
        test_suite = test262.TestSuite(".",
                                       False,
                                       False,
                                       False,
                                       None)

        progress = test262.ProgressIndicator(100)
        progress.succeeded = 98
        progress.failed = 2
        progress.failed_tests = [
            MockResult(MockTest("foo", False)),
            MockResult(MockTest("bar", True))
        ]

        fake_log = cStringIO.StringIO()
        test_suite.logf = fake_log

        expected_out = """
=== Summary ===
 - Ran 100 tests
 - Passed 98 tests (98.0%)
 - Failed 2 tests (2.0%)

Failed Tests
  foo in non-strict mode

Expected to fail but passed ---
  bar in non-strict mode
"""
        expected_log = """=== Summary ===
 - Ran 100 tests
 - Passed 98 tests (98.0%)
 - Failed 2 tests (2.0%)
Failed Tests
  foo in non-strict mode
Expected to fail but passed ---
  bar in non-strict mode
"""

        result = mute(True)(test_suite.PrintSummary)(progress, True)
        self.assertEqual(expected_out, result)
        self.assertEqual(expected_log, fake_log.getvalue())