def test_is_testharness_output_negative_cases(self):
     self.assertFalse(testharness_results.is_testharness_output('foo'))
     self.assertFalse(testharness_results.is_testharness_output(''))
     self.assertFalse(testharness_results.is_testharness_output('   '))
     self.assertFalse(testharness_results.is_testharness_output(
         'This is a testharness.js-based test.  Harness: the test ran to completion.'))
     self.assertFalse(testharness_results.is_testharness_output(
         '   This    \n'
         'is a testharness.js-based test.\n'
         'Harness: the test ran to completion.'))
 def test_is_testharness_output_negative_cases(self):
     self.assertFalse(testharness_results.is_testharness_output('foo'))
     self.assertFalse(testharness_results.is_testharness_output(''))
     self.assertFalse(testharness_results.is_testharness_output('   '))
     self.assertFalse(testharness_results.is_testharness_output(
         'This is a testharness.js-based test.  Harness: the test ran to completion.'))
     self.assertFalse(testharness_results.is_testharness_output(
         '   This    \n'
         'is a testharness.js-based test.\n'
         'Harness: the test ran to completion.'))
 def test_is_testharness_output_positive_cases(self):
     self.assertTrue(testharness_results.is_testharness_output(
         'This is a testharness.js-based test.\n'
         'Harness: the test ran to completion.'))
     self.assertTrue(testharness_results.is_testharness_output(
         '\n'
         ' \r This is a testharness.js-based test. \n'
         ' \r  \n'
         ' \rHarness: the test ran to completion.   \n'
         '\n'))
     self.assertTrue(testharness_results.is_testharness_output(
         'This is a testharness.js-based test.\n'
         'Foo bar \n'
         ' Harness: the test ran to completion.'))
     self.assertTrue(testharness_results.is_testharness_output(
         'This is a testharness.js-based test.\n'
         'FAIL: bah \n'
         ' Harness: the test ran to completion.\n'
         '\n'
         '\n'))
 def test_is_testharness_output_positive_cases(self):
     self.assertTrue(testharness_results.is_testharness_output(
         'This is a testharness.js-based test.\n'
         'Harness: the test ran to completion.'))
     self.assertTrue(testharness_results.is_testharness_output(
         '\n'
         ' \r This is a testharness.js-based test. \n'
         ' \r  \n'
         ' \rHarness: the test ran to completion.   \n'
         '\n'))
     self.assertTrue(testharness_results.is_testharness_output(
         'This is a testharness.js-based test.\n'
         'Foo bar \n'
         ' Harness: the test ran to completion.'))
     self.assertTrue(testharness_results.is_testharness_output(
         'This is a testharness.js-based test.\n'
         'FAIL: bah \n'
         ' Harness: the test ran to completion.\n'
         '\n'
         '\n'))
Example #5
0
    def _compare_testharness_test(self, driver_output, expected_driver_output):
        if expected_driver_output.image or expected_driver_output.audio or expected_driver_output.text:
            return False, []

        if driver_output.image or driver_output.audio or self._is_render_tree(driver_output.text):
            return False, []

        text = driver_output.text or ''

        if not testharness_results.is_testharness_output(text):
            return False, []
        if not testharness_results.is_testharness_output_passing(text):
            return True, [test_failures.FailureTestHarnessAssertion()]
        return True, []
Example #6
0
    def test_is_testharness_output(self):
        test_data = [
            {
                'content': 'foo',
                'result': False
            },
            {
                'content': '',
                'result': False
            },
            {
                'content': '   ',
                'result': False
            },
            {
                'content':
                'This is a testharness.js-based test.\nHarness: the test ran to completion.',
                'result': True
            },
            {
                'content':
                '\n \r This is a testharness.js-based test. \n \r  \n \rHarness: the test ran to completion.   \n\n',
                'result': True
            },
            {
                'content':
                '   This    \nis a testharness.js-based test.\nHarness: the test ran to completion.',
                'result': False
            },
            {
                'content':
                'This is a testharness.js-based test.  Harness: the test ran to completion.',
                'result': False
            },
            {
                'content':
                'This is a testharness.js-based test.\nFoo bar \n Harness: the test ran to completion.',
                'result': True
            },
            {
                'content':
                'This is a testharness.js-based test.\nFAIL: bah \n Harness: the test ran to completion.\n\n\n',
                'result': True
            },
        ]

        for data in test_data:
            self.assertEqual(
                data['result'],
                testharness_results.is_testharness_output(data['content']))
    def test_is_testharness_output(self):
        test_data = [
            {'content': 'foo', 'result': False},
            {'content': '', 'result': False},
            {'content': '   ', 'result': False},
            {'content': 'This is a testharness.js-based test.\nHarness: the test ran to completion.', 'result': True},
            {'content': '\n \r This is a testharness.js-based test. \n \r  \n \rHarness: the test ran to completion.   \n\n', 'result': True},
            {'content': '   This    \nis a testharness.js-based test.\nHarness: the test ran to completion.', 'result': False},
            {'content': 'This is a testharness.js-based test.  Harness: the test ran to completion.', 'result': False},
            {'content': 'This is a testharness.js-based test.\nFoo bar \n Harness: the test ran to completion.', 'result': True},
            {'content': 'This is a testharness.js-based test.\nFAIL: bah \n Harness: the test ran to completion.\n\n\n', 'result': True},
        ]

        for data in test_data:
            self.assertEqual(data['result'], testharness_results.is_testharness_output(data['content']))