Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gtest: Add initial test #150

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,20 @@ add_test(NAME check_help COMMAND ${CMAKE_BINARY_DIR}/credentials-fetcherd "--hel
add_test(NAME run_self_test COMMAND ${CMAKE_BINARY_DIR}/credentials-fetcherd "--self_test")
set_tests_properties(check_help PROPERTIES WILL_FAIL TRUE)
set_tests_properties(run_self_test PROPERTIES WILL_FAIL FALSE)


find_package(GTest CONFIG REQUIRED)
set(TEST_FILES test/tester.cpp)
add_executable(credentials-fetcher-test ${metadata} ${TEST_FILES} common)
target_include_directories(credentials-fetcher-test
PUBLIC
common
${GLIB_INCLUDE_DIR}
${GLIB_CONFIG_DIR}
${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(credentials-fetcher-test gtest gtest_main
systemd
glib-2.0
jsoncpp ssl crypto
krb5 kadm5srv_mit kdb5 gssrpc gssapi_krb5 gssrpc k5crypto
com_err krb5support resolv)
7 changes: 7 additions & 0 deletions test/tester.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <gtest/gtest.h>

#include "daemon.h"

TEST(DaemonTest, InvalidCharacterTest) {
ASSERT_EQ(contains_invalid_characters("abcdef"), 0);
}
Loading