| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Basic tests of things declared in mojio_sys_stat.h. Note that more thorough | 5 // Basic tests of things declared in mojio_sys_stat.h. Note that more thorough |
| 6 // tests are done more directly at a different level. | 6 // tests are done more directly at a different level. |
| 7 | 7 |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| 11 #include "files/public/c/mojio_fcntl.h" | 11 #include "files/c/mojio_fcntl.h" |
| 12 #include "files/public/c/mojio_sys_stat.h" | 12 #include "files/c/mojio_sys_stat.h" |
| 13 #include "files/public/c/mojio_unistd.h" | 13 #include "files/c/mojio_unistd.h" |
| 14 #include "files/public/c/tests/mojio_test_base.h" | 14 #include "files/c/tests/mojio_test_base.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 using MojioSysStatTest = mojio::test::MojioTestBase; | 18 using MojioSysStatTest = mojio::test::MojioTestBase; |
| 19 | 19 |
| 20 TEST_F(MojioSysStatTest, Fstat) { | 20 TEST_F(MojioSysStatTest, Fstat) { |
| 21 const char kTestData[511] = {}; | 21 const char kTestData[511] = {}; |
| 22 | 22 |
| 23 int fd = mojio_creat("my_file", MOJIO_S_IRWXU); | 23 int fd = mojio_creat("my_file", MOJIO_S_IRWXU); |
| 24 EXPECT_GE(fd, 0); | 24 EXPECT_GE(fd, 0); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 TEST_F(MojioSysStatTest, Ebadf) { | 65 TEST_F(MojioSysStatTest, Ebadf) { |
| 66 struct mojio_stat buf = {}; | 66 struct mojio_stat buf = {}; |
| 67 errno = 12345; | 67 errno = 12345; |
| 68 int result = mojio_fstat(-1, &buf); | 68 int result = mojio_fstat(-1, &buf); |
| 69 int errno_value = errno; | 69 int errno_value = errno; |
| 70 EXPECT_EQ(-1, result); | 70 EXPECT_EQ(-1, result); |
| 71 EXPECT_EQ(EBADF, errno_value); | 71 EXPECT_EQ(EBADF, errno_value); |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace | 74 } // namespace |
| OLD | NEW |