MCPcopy Create free account
hub / github.com/bytedance/bolt / TEST_F

Function TEST_F

bolt/expression/tests/ExpressionVerifierUnitTest.cpp:102–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100};
101
102TEST_F(ExpressionVerifierUnitTest, persistReproInfo) {
103 filesystems::registerLocalFileSystem();
104 auto reproFolder = exec::test::TempDirectoryPath::create();
105 const auto reproPath = reproFolder->path;
106 auto localFs = filesystems::getFileSystem(reproPath, nullptr);
107
108 ExpressionVerifierOptions options{false, reproPath.c_str(), false};
109 ExpressionVerifier verifier{&execCtx_, options};
110
111 auto testReproPersistency = [this](
112 ExpressionVerifier& verifier,
113 const std::string& reproPath,
114 auto& localFs,
115 const bool forUserError,
116 const bool forRuntimeError) {
117 BOLT_USER_CHECK_NE(forUserError, forRuntimeError);
118
119 auto data = makeRowVector({makeFlatVector<int32_t>({1, 2, 3})});
120 auto plan = parseExpression("always_throws(c0)", asRowType(data->type()));
121
122 removeDirecrtoryIfExist(localFs, reproPath);
123 if (forUserError) {
124 BOLT_ASSERT_THROW(verifier.verify({plan}, data, nullptr, false), "");
125 } else {
126 EXPECT_NO_THROW(verifier.verify({plan}, data, nullptr, false));
127 }
128
129 EXPECT_TRUE(localFs->exists(reproPath));
130 EXPECT_FALSE(localFs->list(reproPath).empty());
131 removeDirecrtoryIfExist(localFs, reproPath);
132 };
133
134 // User errors.
135 {
136 registerFunction<AlwaysThrowsUserErrorFunction, int32_t, int32_t>(
137 {"always_throws"});
138 testReproPersistency(verifier, reproPath, localFs, true, false);
139 }
140
141 // Runtime errors.
142 {
143 registerFunction<AlwaysThrowsRuntimeErrorFunction, int32_t, int32_t>(
144 {"always_throws"});
145 testReproPersistency(verifier, reproPath, localFs, false, true);
146 }
147}
148
149} // namespace bytedance::bolt::test

Callers

nothing calls this directly

Calls 11

registerLocalFileSystemFunction · 0.85
getFileSystemFunction · 0.85
parseExpressionFunction · 0.85
asRowTypeFunction · 0.85
removeDirecrtoryIfExistFunction · 0.85
createFunction · 0.50
typeMethod · 0.45
verifyMethod · 0.45
existsMethod · 0.45
emptyMethod · 0.45
listMethod · 0.45

Tested by

no test coverage detected