| 135 | }; |
| 136 | |
| 137 | Result<std::string> readFileCached(const fs::path& file) { |
| 138 | static std::map<std::string, std::string> fileCache; |
| 139 | auto findItr = fileCache.find(file); |
| 140 | if (findItr != fileCache.end()) { |
| 141 | return findItr->second; |
| 142 | } |
| 143 | |
| 144 | auto loadResult = DiskUtils::load(Path(file.string())); |
| 145 | if (!loadResult) { |
| 146 | TEST262_LOG(cerr, "Failed to load {} with error {}", file.string(), loadResult.error().getMessage()); |
| 147 | return loadResult.error(); |
| 148 | } |
| 149 | const auto loadData = loadResult.moveValue(); |
| 150 | |
| 151 | fileCache[file] = loadData.asStringView(); |
| 152 | return fileCache[file]; |
| 153 | } |
| 154 | |
| 155 | enum class ExecutionResult { |
| 156 | RunWithPass, |
no test coverage detected