Returns all the matched entries as a comma separated string removing the common prefix of BaseDir().
| 150 | // Returns all the matched entries as a comma separated string removing the |
| 151 | // common prefix of BaseDir(). |
| 152 | string Match(InterPlanetaryFileSystem* ipfs, const string& suffix_pattern) { |
| 153 | std::vector<string> results; |
| 154 | Status s = |
| 155 | ipfs->GetMatchingPaths(io::JoinPath(kPrefix, suffix_pattern), &results); |
| 156 | if (!s.ok()) { |
| 157 | return s.ToString(); |
| 158 | } else { |
| 159 | std::vector<StringPiece> trimmed_results; |
| 160 | std::sort(results.begin(), results.end()); |
| 161 | for (const string& result : results) { |
| 162 | StringPiece trimmed_result(result); |
| 163 | EXPECT_TRUE( |
| 164 | absl::ConsumePrefix(&trimmed_result, strings::StrCat(kPrefix, "/"))); |
| 165 | trimmed_results.push_back(trimmed_result); |
| 166 | } |
| 167 | return absl::StrJoin(trimmed_results, ","); |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | TEST(InterPlanetaryFileSystemTest, IPFSMatch) { |
| 172 | InterPlanetaryFileSystem ipfs; |
no test coverage detected