| 1121 | } |
| 1122 | |
| 1123 | void GenericFileSystemTest::TestOpenInputStreamAsync(FileSystem* fs) { |
| 1124 | ASSERT_OK(fs->CreateDir("AB")); |
| 1125 | CreateFile(fs, "AB/abc", "some data"); |
| 1126 | |
| 1127 | std::shared_ptr<io::InputStream> stream; |
| 1128 | std::shared_ptr<Buffer> buffer; |
| 1129 | std::shared_ptr<const KeyValueMetadata> metadata; |
| 1130 | ASSERT_FINISHES_OK_AND_ASSIGN(stream, fs->OpenInputStreamAsync("AB/abc")); |
| 1131 | ASSERT_FINISHES_OK_AND_ASSIGN(metadata, stream->ReadMetadataAsync()); |
| 1132 | ASSERT_OK_AND_ASSIGN(buffer, stream->Read(4)); |
| 1133 | AssertBufferEqual(*buffer, "some"); |
| 1134 | ASSERT_OK(stream->Close()); |
| 1135 | |
| 1136 | // File does not exist |
| 1137 | AssertRaisesWithErrno(ENOENT, fs->OpenInputStreamAsync("AB/def").result()); |
| 1138 | } |
| 1139 | |
| 1140 | void GenericFileSystemTest::TestOpenInputFile(FileSystem* fs) { |
| 1141 | ASSERT_OK(fs->CreateDir("AB")); |
nothing calls this directly
no test coverage detected