summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/test_uncrustify/failure.py
blob: 0972930fa0d61f9d07089004b10cab831e68e7b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Exceptions when a test fails.
#
# * @author  Matthew Woehlke    June 2018
#


# =============================================================================
class Failure(Exception):
    pass

# =============================================================================
class TestDeclarationParseError(Failure):
    # -------------------------------------------------------------------------
    def __init__(self, test_suite, line_number):
        self.test_suite = test_suite
        self.line_number = line_number

    # -------------------------------------------------------------------------
    def __str__(self):
        return 'Error parsing line {!r} from the {!r} test suite'.format(
            self.line_number, self.test_suite)


# =============================================================================
class ExecutionFailure(Failure):
    # -------------------------------------------------------------------------
    def __init__(self, exception):
        self.exception = exception

    # -------------------------------------------------------------------------
    def __str__(self):
        return str(self.exception)


# =============================================================================
class MissingFailure(Failure):
    # -------------------------------------------------------------------------
    def __init__(self, exception, missing_path):
        self.exception = exception
        self.missing_path = missing_path

    # -------------------------------------------------------------------------
    def __str__(self):
        return 'Expected output file not found: {!r}'.format(self.missing_path)


# =============================================================================
class MismatchFailure(Failure):
    # -------------------------------------------------------------------------
    def __init__(self, expected, actual):
        self.expected_path = expected
        self.actual_path = actual

    # -------------------------------------------------------------------------
    def __str__(self):
        return 'Output {!r} does not match expected output {!r}'.format(
            self.actual_path, self.expected_path)


# =============================================================================
class UnstableFailure(Failure):
    # -------------------------------------------------------------------------
    def __init__(self, expected, actual):
        self.expected_path = expected
        self.actual_path = actual

    # -------------------------------------------------------------------------
    def __str__(self):
        return 'Output {!r} does not match expected output {!r}'.format(
            self.actual_path, self.expected_path)

# =============================================================================
class UnexpectedlyPassingFailure(Failure):
    # -------------------------------------------------------------------------
    def __init__(self, expected, actual):
        self.expected_path = expected
        self.actual_path = actual

    # -------------------------------------------------------------------------
    def __str__(self):
        return 'Output {!r} unexpectedly matches expected output {!r}'.format(
            self.actual_path, self.expected_path)