MCPcopy Create free account
hub / github.com/Snapchat/Valdi / runTestCases

Function runTestCases

tsn/src/test262/runner/main.cpp:264–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264bool runTestCases(const fs::path& harnessDirectory,
265 const fs::path& testCaseFile,
266 const fs::path& outputFile,
267 const fs::path& skipListFile) {
268 const auto testCasesResult = deserializeTestCases(testCaseFile);
269 if (!testCasesResult) {
270 TEST262_LOG(cerr, "Failed to parse {} with error {}", testCaseFile, testCasesResult.error().getMessage());
271 return false;
272 }
273
274 const auto skipList = decodeSkipList(skipListFile);
275 const auto testCases = testCasesResult.value();
276
277 TestReporter reporter;
278
279 for (const auto& testCase : testCases) {
280 const auto& metadata = testCase.second;
281 std::string test_contents;
282
283 // NOTE(rjaber): This should be intentionally omitted by the preprocessor
284 if (metadata.isNegative && metadata.negativeType == "SyntaxError") {
285 TEST262_LOG(cerr, "Found invalid case in test cases {}", testCase.first);
286 return false;
287 }
288
289 if (metadata.noStrict || metadata.raw) {
290 evaluateTestCase(skipList, harnessDirectory, testCase.first, metadata, false, reporter);
291 } else if (metadata.onlyStrict) {
292 evaluateTestCase(skipList, harnessDirectory, testCase.first, metadata, true, reporter);
293 } else {
294 evaluateTestCase(skipList, harnessDirectory, testCase.first, metadata, false, reporter);
295 evaluateTestCase(skipList, harnessDirectory, testCase.first, metadata, true, reporter);
296 }
297 }
298
299 reporter.saveToFile(outputFile);
300 return !reporter.hasFailure();
301}
302
303int main(int argc, const char* argv[]) {
304 fs::path testCaseFile;

Callers 1

mainFunction · 0.85

Calls 8

deserializeTestCasesFunction · 0.85
decodeSkipListFunction · 0.85
evaluateTestCaseFunction · 0.85
saveToFileMethod · 0.80
hasFailureMethod · 0.80
getMessageMethod · 0.65
errorMethod · 0.65
valueMethod · 0.65

Tested by

no test coverage detected