mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Add tests for native GetFileOwner
This commit is contained in:
1 parent
e6d3cbcce0
commit
f3328fec5c
2 files changed
+33
No files matched your search
@@ -1,6 +1,7 @@
|
||||
add_subdirectory(googletest)
|
||||
|
||||
add_executable(psl-native-test
|
||||
test-getfileowner.cpp
|
||||
test-locale.cpp
|
||||
test-getcurrentprocessid.cpp
|
||||
test-getusername.cpp
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
//! @file test-getfileowner.cpp
|
||||
//! @author Andrew Schwartzmeyer <andschwa@microsoft.com>
|
||||
//! @brief Tests GetFileOwner
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include "getfileowner.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
//! Test fixture for GetFileOwner
|
||||
class GetFileOwnerTest : public ::testing::Test
|
||||
{
|
||||
};
|
||||
|
||||
TEST_F(GetFileOwnerTest, CanGetOwnerOfRoot)
|
||||
{
|
||||
ASSERT_STREQ(GetFileOwner("/"), "root");
|
||||
}
|
||||
|
||||
TEST_F(GetFileOwnerTest, CannotGetOwnerOfFakeFile)
|
||||
{
|
||||
EXPECT_STREQ(GetFileOwner("SomeMadeUpFileNameThatDoesNotExist"), NULL);
|
||||
EXPECT_EQ(errno, ERROR_FILE_NOT_FOUND);
|
||||
}
|
||||
|
||||
TEST_F(GetFileOwnerTest, ReturnsNullForNullInput)
|
||||
{
|
||||
EXPECT_STREQ(GetFileOwner(NULL), NULL);
|
||||
EXPECT_EQ(errno, ERROR_INVALID_PARAMETER);
|
||||
}
|
||||
Reference in new issue
Block a user