| 39 | namespace snappy { |
| 40 | |
| 41 | std::string ReadTestDataFile(const char* base, size_t size_limit) { |
| 42 | std::string srcdir; |
| 43 | const char* srcdir_env = std::getenv("srcdir"); // This is set by Automake. |
| 44 | if (srcdir_env) { |
| 45 | srcdir = std::string(srcdir_env) + "/"; |
| 46 | } |
| 47 | |
| 48 | std::string contents; |
| 49 | CHECK_OK(file::GetContents(srcdir + "testdata/" + base, &contents, |
| 50 | file::Defaults())); |
| 51 | if (size_limit > 0) { |
| 52 | contents = contents.substr(0, size_limit); |
| 53 | } |
| 54 | return contents; |
| 55 | } |
| 56 | |
| 57 | } // namespace snappy |
nothing calls this directly
no test coverage detected