def test_too_many_expected_raises_and_excess_check_line_in_error(self):
        actual = _tmpfile('foo\nbar\n')
        expected = _tmpfile('c: foo\nc: bar\nc: baz\n')
        with self.assertRaises(XCTestCheckerError) as cm:
            compare.compare(open(actual, 'r'), expected, check_prefix='c: ')

        self.assertIn('{}:{}'.format(expected, 3), cm.exception.message)
    def test_includes_file_name_and_line_of_expected_in_error(self):
        actual = _tmpfile('foo\nbar\nbaz\n')
        expected = _tmpfile('c: foo\nc: baz\nc: bar\n')
        with self.assertRaises(AssertionError) as cm:
            compare.compare(actual, expected, check_prefix='c: ')

        self.assertIn("{}:{}:".format(expected, 2), cm.exception.message)
Пример #3
0
    def test_includes_file_name_and_line_of_expected_in_error(self):
        actual = _tmpfile('foo\nbar\nbaz\n')
        expected = _tmpfile('c: foo\nc: baz\nc: bar\n')
        with self.assertRaises(XCTestCheckerError) as cm:
            compare.compare(open(actual, 'r'), expected, check_prefix='c: ')

        self.assertIn("{}:{}:".format(expected, 2), cm.exception.message)
    def test_check_prefix_twice_in_the_same_line_raises_with_line(self):
        actual = _tmpfile('blorp\nbleep\n')
        expected = _tmpfile('c: blorp\nc: bleep c: blammo\n')
        with self.assertRaises(XCTestCheckerError) as cm:
            compare.compare(open(actual, 'r'), expected, check_prefix='c: ')

        self.assertIn('{}:{}'.format(expected, 2), cm.exception.message)
Пример #5
0
    def test_includes_file_name_and_line_of_expected_in_error(self):
        actual = _tmpfile('foo\nbar\nbaz\n')
        expected = _tmpfile('c: foo\nc: baz\nc: bar\n')
        with self.assertRaises(XCTestCheckerError) as cm:
            compare.compare(open(actual, 'r'), expected, check_prefix='c: ')

        self.assertIn("{}:{}:".format(expected, 2), str(cm.exception))
 def test_match_does_not_raise(self):
     actual = _tmpfile('foo\nbar\nbaz\n')
     expected = _tmpfile('c: foo\nc: bar\nc: baz\n')
     compare.compare(actual, expected, check_prefix='c: ')
 def test_too_many_expected_raises(self):
     actual = _tmpfile('foo\nbar\n')
     expected = _tmpfile('c: foo\nc: bar\nc: baz\n')
     with self.assertRaises(AssertionError):
         compare.compare(actual, expected, check_prefix='c: ')
 def test_line_number_substitution(self):
     actual = _tmpfile('beep 1\nboop 5\n')
     expected = _tmpfile('c: beep [[@LINE]]\nc: boop [[@LINE+3]]')
     compare.compare(open(actual, 'r'), expected, check_prefix='c: ')
 def test_can_explicitly_match_leading_and_trailing_whitespace(self):
     actual = _tmpfile('foo\n bar\nbaz \n')
     expected = _tmpfile('c: foo\nc: ^ bar \nc: baz $\n')
     compare.compare(open(actual, 'r'), expected, check_prefix='c:')
 def test_matching_ignores_leading_and_trailing_whitespace(self):
     actual = _tmpfile('foo\nbar\nbaz\n')
     expected = _tmpfile('c:  foo\nc: bar \nc: baz\n')
     compare.compare(open(actual, 'r'), expected, check_prefix='c:')
 def test_check_prefix_in_run_line_ignored(self):
     actual = _tmpfile('flim\n')
     expected = _tmpfile('// RUN: xctest_checker --prefix "c: "\nc: flim\n')
     compare.compare(open(actual, 'r'), expected, check_prefix='c: ')
 def test_match_with_inline_check_does_not_raise(self):
     actual = _tmpfile('bling\nblong\n')
     expected = _tmpfile('meep meep // c: bling\nmeep\n// c: blong\n')
     compare.compare(open(actual, 'r'), expected, check_prefix='// c: ')
Пример #13
0
 def test_match_does_not_raise(self):
     actual = _tmpfile('foo\nbar\nbaz\n')
     expected = _tmpfile('c: foo\nc: bar\nc: baz\n')
     compare.compare(open(actual, 'r'), expected, check_prefix='c: ')
 def test_no_match_raises(self):
     actual = _tmpfile('foo\nbar\nbaz\n')
     expected = _tmpfile('c: foo\nc: baz\nc: bar\n')
     with self.assertRaises(XCTestCheckerError):
         compare.compare(open(actual, 'r'), expected, check_prefix='c: ')
Пример #15
0
 def test_too_many_expected_raises(self):
     actual = _tmpfile('foo\nbar\n')
     expected = _tmpfile('c: foo\nc: bar\nc: baz\n')
     with self.assertRaises(AssertionError):
         compare.compare(actual, expected, check_prefix='c: ')