| 175 | class TestFileDescriptor : public ::testing::Test { |
| 176 | public: |
| 177 | Result<int> NewFileDescriptor() { |
| 178 | // Make a new fd by dup'ing C stdout (why not?) |
| 179 | int new_fd = dup(1); |
| 180 | if (new_fd < 0) { |
| 181 | return IOErrorFromErrno(errno, "Failed to dup() C stdout"); |
| 182 | } |
| 183 | return new_fd; |
| 184 | } |
| 185 | |
| 186 | void AssertValidFileDescriptor(int fd) { |
| 187 | ASSERT_FALSE(FileIsClosed(fd)) << "Not a valid file descriptor: " << fd; |
nothing calls this directly
no test coverage detected