tesseract v5.3.3.20231005
googletest-catch-exceptions-test.CatchCxxExceptionsTest Class Reference
Inheritance diagram for googletest-catch-exceptions-test.CatchCxxExceptionsTest:

Public Member Functions

def testCatchesCxxExceptionsInFixtureConstructor (self)
 
def testCatchesCxxExceptionsInFixtureDestructor (self)
 
def testCatchesCxxExceptionsInSetUpTestCase (self)
 
def testCatchesCxxExceptionsInTearDownTestCase (self)
 
def testCatchesCxxExceptionsInSetUp (self)
 
def testCatchesCxxExceptionsInTearDown (self)
 
def testCatchesCxxExceptionsInTestBody (self)
 
def testCatchesNonStdCxxExceptions (self)
 
def testUnhandledCxxExceptionsAbortTheProgram (self)
 

Detailed Description

Tests C++ exception-catching behavior.

   Tests in this test case verify that:
   * C++ exceptions are caught and logged as C++ (not SEH) exceptions
   * Exception thrown affect the remainder of the test work flow in the
     expected manner.

Definition at line 110 of file googletest-catch-exceptions-test.py.

Member Function Documentation

◆ testCatchesCxxExceptionsInFixtureConstructor()

def googletest-catch-exceptions-test.CatchCxxExceptionsTest.testCatchesCxxExceptionsInFixtureConstructor (   self)

Definition at line 119 of file googletest-catch-exceptions-test.py.

119 def testCatchesCxxExceptionsInFixtureConstructor(self):
120 self.assertTrue(
121 'C++ exception with description '
122 '"Standard C++ exception" thrown '
123 'in the test fixture\'s constructor' in EX_BINARY_OUTPUT,
124 EX_BINARY_OUTPUT)
125 self.assert_('unexpected' not in EX_BINARY_OUTPUT,
126 'This failure belongs in this test only if '
127 '"CxxExceptionInConstructorTest" (no quotes) '
128 'appears on the same line as words "called unexpectedly"')
129

◆ testCatchesCxxExceptionsInFixtureDestructor()

def googletest-catch-exceptions-test.CatchCxxExceptionsTest.testCatchesCxxExceptionsInFixtureDestructor (   self)

Definition at line 133 of file googletest-catch-exceptions-test.py.

133 def testCatchesCxxExceptionsInFixtureDestructor(self):
134 self.assertTrue(
135 'C++ exception with description '
136 '"Standard C++ exception" thrown '
137 'in the test fixture\'s destructor' in EX_BINARY_OUTPUT,
138 EX_BINARY_OUTPUT)
139 self.assertTrue(
140 'CxxExceptionInDestructorTest::TearDownTestSuite() '
141 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
142

◆ testCatchesCxxExceptionsInSetUp()

def googletest-catch-exceptions-test.CatchCxxExceptionsTest.testCatchesCxxExceptionsInSetUp (   self)

Definition at line 171 of file googletest-catch-exceptions-test.py.

171 def testCatchesCxxExceptionsInSetUp(self):
172 self.assertTrue(
173 'C++ exception with description "Standard C++ exception"'
174 ' thrown in SetUp()' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
175 self.assertTrue(
176 'CxxExceptionInSetUpTest::TearDownTestSuite() '
177 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
178 self.assertTrue(
179 'CxxExceptionInSetUpTest destructor '
180 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
181 self.assertTrue(
182 'CxxExceptionInSetUpTest::TearDown() '
183 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
184 self.assert_('unexpected' not in EX_BINARY_OUTPUT,
185 'This failure belongs in this test only if '
186 '"CxxExceptionInSetUpTest" (no quotes) '
187 'appears on the same line as words "called unexpectedly"')
188

◆ testCatchesCxxExceptionsInSetUpTestCase()

def googletest-catch-exceptions-test.CatchCxxExceptionsTest.testCatchesCxxExceptionsInSetUpTestCase (   self)

Definition at line 143 of file googletest-catch-exceptions-test.py.

143 def testCatchesCxxExceptionsInSetUpTestCase(self):
144 self.assertTrue(
145 'C++ exception with description "Standard C++ exception"'
146 ' thrown in SetUpTestSuite()' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
147 self.assertTrue(
148 'CxxExceptionInConstructorTest::TearDownTestSuite() '
149 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
150 self.assertTrue(
151 'CxxExceptionInSetUpTestSuiteTest constructor '
152 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
153 self.assertTrue(
154 'CxxExceptionInSetUpTestSuiteTest destructor '
155 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
156 self.assertTrue(
157 'CxxExceptionInSetUpTestSuiteTest::SetUp() '
158 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
159 self.assertTrue(
160 'CxxExceptionInSetUpTestSuiteTest::TearDown() '
161 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
162 self.assertTrue(
163 'CxxExceptionInSetUpTestSuiteTest test body '
164 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
165

◆ testCatchesCxxExceptionsInTearDown()

def googletest-catch-exceptions-test.CatchCxxExceptionsTest.testCatchesCxxExceptionsInTearDown (   self)

Definition at line 189 of file googletest-catch-exceptions-test.py.

189 def testCatchesCxxExceptionsInTearDown(self):
190 self.assertTrue(
191 'C++ exception with description "Standard C++ exception"'
192 ' thrown in TearDown()' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
193 self.assertTrue(
194 'CxxExceptionInTearDownTest::TearDownTestSuite() '
195 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
196 self.assertTrue(
197 'CxxExceptionInTearDownTest destructor '
198 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
199

◆ testCatchesCxxExceptionsInTearDownTestCase()

def googletest-catch-exceptions-test.CatchCxxExceptionsTest.testCatchesCxxExceptionsInTearDownTestCase (   self)

Definition at line 166 of file googletest-catch-exceptions-test.py.

166 def testCatchesCxxExceptionsInTearDownTestCase(self):
167 self.assertTrue(
168 'C++ exception with description "Standard C++ exception"'
169 ' thrown in TearDownTestSuite()' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
170

◆ testCatchesCxxExceptionsInTestBody()

def googletest-catch-exceptions-test.CatchCxxExceptionsTest.testCatchesCxxExceptionsInTestBody (   self)

Definition at line 200 of file googletest-catch-exceptions-test.py.

200 def testCatchesCxxExceptionsInTestBody(self):
201 self.assertTrue(
202 'C++ exception with description "Standard C++ exception"'
203 ' thrown in the test body' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
204 self.assertTrue(
205 'CxxExceptionInTestBodyTest::TearDownTestSuite() '
206 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
207 self.assertTrue(
208 'CxxExceptionInTestBodyTest destructor '
209 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
210 self.assertTrue(
211 'CxxExceptionInTestBodyTest::TearDown() '
212 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
213

◆ testCatchesNonStdCxxExceptions()

def googletest-catch-exceptions-test.CatchCxxExceptionsTest.testCatchesNonStdCxxExceptions (   self)

Definition at line 214 of file googletest-catch-exceptions-test.py.

214 def testCatchesNonStdCxxExceptions(self):
215 self.assertTrue(
216 'Unknown C++ exception thrown in the test body' in EX_BINARY_OUTPUT,
217 EX_BINARY_OUTPUT)
218

◆ testUnhandledCxxExceptionsAbortTheProgram()

def googletest-catch-exceptions-test.CatchCxxExceptionsTest.testUnhandledCxxExceptionsAbortTheProgram (   self)

Definition at line 219 of file googletest-catch-exceptions-test.py.

219 def testUnhandledCxxExceptionsAbortTheProgram(self):
220 # Filters out SEH exception tests on Windows. Unhandled SEH exceptions
221 # cause tests to show pop-up windows there.
222 FITLER_OUT_SEH_TESTS_FLAG = FILTER_FLAG + '=-*Seh*'
223 # By default, Google Test doesn't catch the exceptions.
224 uncaught_exceptions_ex_binary_output = gtest_test_utils.Subprocess(
225 [EX_EXE_PATH,
226 NO_CATCH_EXCEPTIONS_FLAG,
227 FITLER_OUT_SEH_TESTS_FLAG],
228 env=environ).output
229
230 self.assert_('Unhandled C++ exception terminating the program'
231 in uncaught_exceptions_ex_binary_output)
232 self.assert_('unexpected' not in uncaught_exceptions_ex_binary_output)
233
234

The documentation for this class was generated from the following file: