Skip to content

Commit 44e5bb2

Browse files
committed
[core] Enforce uninitialized gCling in test
1 parent c632b91 commit 44e5bb2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

core/clingutils/test/TClingUtilsTests.cxx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// test was to do any of the above, there would be two copies of functions around (in libCling.so and the test binary)
2222
// with not much guarantees which ones are called at which moment.
2323

24+
#include <DllImport.h>
2425
#include <ROOT/FoundationUtils.hxx>
2526

2627
#include "gtest/gtest.h"
@@ -90,3 +91,13 @@ TEST(TClingUtilsTests, GetRealPath)
9091
std::remove("./realfile2");
9192
#endif // not R__WIN32
9293
}
94+
95+
// Forward-declare gCling to not include TInterpreter.h just for checking that the interpreter has not been initialized.
96+
class TInterpreter;
97+
R__EXTERN TInterpreter *gCling;
98+
99+
class InterpreterCheck : public testing::Environment {
100+
void TearDown() override { ASSERT_EQ(gCling, nullptr); }
101+
};
102+
103+
testing::Environment *gInterpreterCheck = testing::AddGlobalTestEnvironment(new InterpreterCheck);

0 commit comments

Comments
 (0)