Refactor posix tests

This commit is contained in:
vitaut 2015-06-24 08:43:30 -07:00
parent e5b16e80cc
commit 9769f4b9ed
4 changed files with 7 additions and 12 deletions

View File

@ -41,10 +41,6 @@
#include "format.h" #include "format.h"
#ifdef FMT_INCLUDE_POSIX_TEST
# include "test/posix-test.h"
#endif
#ifndef FMT_POSIX #ifndef FMT_POSIX
# if defined(_WIN32) && !defined(__MINGW32__) # if defined(_WIN32) && !defined(__MINGW32__)
// Fix warnings about deprecated symbols. // Fix warnings about deprecated symbols.

View File

@ -62,9 +62,7 @@ add_executable(macro-test macro-test.cc ${FMT_TEST_SOURCES} ${TEST_MAIN_SRC})
target_link_libraries(macro-test gmock) target_link_libraries(macro-test gmock)
if (HAVE_OPEN) if (HAVE_OPEN)
add_executable(posix-test posix-test.cc ${FMT_TEST_SOURCES} ${TEST_MAIN_SRC}) add_executable(posix-test posix-mock-test.cc ../format.cc ${TEST_MAIN_SRC})
set_target_properties(posix-test
PROPERTIES COMPILE_DEFINITIONS "FMT_INCLUDE_POSIX_TEST=1")
target_link_libraries(posix-test gmock) target_link_libraries(posix-test gmock)
add_test(NAME posix-test COMMAND posix-test) add_test(NAME posix-test COMMAND posix-test)
endif () endif ()

View File

@ -1,7 +1,7 @@
/* /*
Test wrappers around POSIX functions. Tests of the C++ interface to POSIX functions that require mocks
Copyright (c) 2012-2014, Victor Zverovich Copyright (c) 2012-2015, Victor Zverovich
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -28,7 +28,8 @@
// Disable bogus MSVC warnings. // Disable bogus MSVC warnings.
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
#include "posix-test.h" #include "posix-mock.h"
#include "posix.cc"
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>

View File

@ -1,7 +1,7 @@
/* /*
Test wrappers around POSIX functions. Mocks of POSIX functions
Copyright (c) 2012-2014, Victor Zverovich Copyright (c) 2012-2015, Victor Zverovich
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without