@@ -28,69 +28,69 @@ def test_no_match_raises(self):
28
28
actual = _tmpfile ('foo\n bar\n baz\n ' )
29
29
expected = _tmpfile ('c: foo\n c: baz\n c: bar\n ' )
30
30
with self .assertRaises (XCTestCheckerError ):
31
- compare .compare (actual , expected , check_prefix = 'c: ' )
31
+ compare .compare (open ( actual , 'r' ) , expected , check_prefix = 'c: ' )
32
32
33
33
def test_too_few_expected_raises_and_first_line_in_error (self ):
34
34
actual = _tmpfile ('foo\n bar\n baz\n ' )
35
35
expected = _tmpfile ('c: foo\n c: bar\n ' )
36
36
with self .assertRaises (XCTestCheckerError ) as cm :
37
- compare .compare (actual , expected , check_prefix = 'c: ' )
37
+ compare .compare (open ( actual , 'r' ) , expected , check_prefix = 'c: ' )
38
38
39
39
self .assertIn ('{}:{}' .format (expected , 1 ), cm .exception .message )
40
40
41
41
def test_too_many_expected_raises_and_excess_check_line_in_error (self ):
42
42
actual = _tmpfile ('foo\n bar\n ' )
43
43
expected = _tmpfile ('c: foo\n c: bar\n c: baz\n ' )
44
44
with self .assertRaises (XCTestCheckerError ) as cm :
45
- compare .compare (actual , expected , check_prefix = 'c: ' )
45
+ compare .compare (open ( actual , 'r' ) , expected , check_prefix = 'c: ' )
46
46
47
47
self .assertIn ('{}:{}' .format (expected , 3 ), cm .exception .message )
48
48
49
49
def test_match_does_not_raise (self ):
50
50
actual = _tmpfile ('foo\n bar\n baz\n ' )
51
51
expected = _tmpfile ('c: foo\n c: bar\n c: baz\n ' )
52
- compare .compare (actual , expected , check_prefix = 'c: ' )
52
+ compare .compare (open ( actual , 'r' ) , expected , check_prefix = 'c: ' )
53
53
54
54
def test_match_with_inline_check_does_not_raise (self ):
55
55
actual = _tmpfile ('bling\n blong\n ' )
56
56
expected = _tmpfile ('meep meep // c: bling\n meep\n // c: blong\n ' )
57
- compare .compare (actual , expected , check_prefix = '// c: ' )
57
+ compare .compare (open ( actual , 'r' ) , expected , check_prefix = '// c: ' )
58
58
59
59
def test_check_prefix_twice_in_the_same_line_raises_with_line (self ):
60
60
actual = _tmpfile ('blorp\n bleep\n ' )
61
61
expected = _tmpfile ('c: blorp\n c: bleep c: blammo\n ' )
62
62
with self .assertRaises (XCTestCheckerError ) as cm :
63
- compare .compare (actual , expected , check_prefix = 'c: ' )
63
+ compare .compare (open ( actual , 'r' ) , expected , check_prefix = 'c: ' )
64
64
65
65
self .assertIn ('{}:{}' .format (expected , 2 ), cm .exception .message )
66
66
67
67
def test_check_prefix_in_run_line_ignored (self ):
68
68
actual = _tmpfile ('flim\n ' )
69
69
expected = _tmpfile ('// RUN: xctest_checker --prefix "c: "\n c: flim\n ' )
70
- compare .compare (actual , expected , check_prefix = 'c: ' )
70
+ compare .compare (open ( actual , 'r' ) , expected , check_prefix = 'c: ' )
71
71
72
72
def test_includes_file_name_and_line_of_expected_in_error (self ):
73
73
actual = _tmpfile ('foo\n bar\n baz\n ' )
74
74
expected = _tmpfile ('c: foo\n c: baz\n c: bar\n ' )
75
75
with self .assertRaises (XCTestCheckerError ) as cm :
76
- compare .compare (actual , expected , check_prefix = 'c: ' )
76
+ compare .compare (open ( actual , 'r' ) , expected , check_prefix = 'c: ' )
77
77
78
78
self .assertIn ("{}:{}:" .format (expected , 2 ), cm .exception .message )
79
79
80
80
def test_matching_ignores_leading_and_trailing_whitespace (self ):
81
81
actual = _tmpfile ('foo\n bar\n baz\n ' )
82
82
expected = _tmpfile ('c: foo\n c: bar \n c: baz\n ' )
83
- compare .compare (actual , expected , check_prefix = 'c:' )
83
+ compare .compare (open ( actual , 'r' ) , expected , check_prefix = 'c:' )
84
84
85
85
def test_can_explicitly_match_leading_and_trailing_whitespace (self ):
86
86
actual = _tmpfile ('foo\n bar\n baz \n ' )
87
87
expected = _tmpfile ('c: foo\n c: ^ bar \n c: baz $\n ' )
88
- compare .compare (actual , expected , check_prefix = 'c:' )
88
+ compare .compare (open ( actual , 'r' ) , expected , check_prefix = 'c:' )
89
89
90
90
def test_line_number_substitution (self ):
91
91
actual = _tmpfile ('beep 1\n boop 5\n ' )
92
92
expected = _tmpfile ('c: beep [[@LINE]]\n c: boop [[@LINE+3]]' )
93
- compare .compare (actual , expected , check_prefix = 'c: ' )
93
+ compare .compare (open ( actual , 'r' ) , expected , check_prefix = 'c: ' )
94
94
95
95
if __name__ == "__main__" :
96
96
unittest .main ()
0 commit comments