Skip to content

Commit

Permalink
Add another test
Browse files Browse the repository at this point in the history
Signed-off-by: Juanjo Alvarez <juanjo.alvarezmartinez@datadoghq.com>
  • Loading branch information
juanjux committed Sep 23, 2024
1 parent eaf7d3c commit d2e450a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ddtrace/appsec/_iast/_taint_tracking/tests/test_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ TEST_F(PythonErrorGuardCheck, Error)
PyErr_Clear();
}

TEST_F(PythonErrorGuardCheck, ErrorIsClearedThenNoErrorInGuard)
{
PyErr_SetString(PyExc_RuntimeError, "Test error");
{
PythonErrorGuard guard;
EXPECT_TRUE(guard.has_error());
EXPECT_STREQ(guard.error_as_stdstring().c_str(), "Test error");
EXPECT_STREQ(guard.error_as_pystr().cast<std::string>().c_str(), "Test error");
}
PyErr_Clear();
PythonErrorGuard guard;
EXPECT_FALSE(guard.has_error());
}

void set_python_exception_with_traceback() {
py::gil_scoped_acquire acquire;

Expand Down

0 comments on commit d2e450a

Please sign in to comment.