aboutsummaryrefslogtreecommitdiff
path: root/src/mock
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2021-05-27 23:37:23 +0200
committerJan200101 <sentrycraft123@gmail.com>2021-05-27 23:37:23 +0200
commitdf1df2929646abd77955b80e3ded3574ac005179 (patch)
tree9704901455843d41180a9402ed4c0012a1d67f04 /src/mock
parent68c20667ca775a4d4a7d1cfc3c9ec5c30f275084 (diff)
downloadpolecat-df1df2929646abd77955b80e3ded3574ac005179.tar.gz
polecat-df1df2929646abd77955b80e3ded3574ac005179.zip
allow flags to exit prematurely, move defines, add no networking flag
Diffstat (limited to 'src/mock')
-rw-r--r--src/mock/CMakeLists.txt3
-rw-r--r--src/mock/libcurl.c (renamed from src/mock/libcurl/libcurl.c)12
2 files changed, 9 insertions, 6 deletions
diff --git a/src/mock/CMakeLists.txt b/src/mock/CMakeLists.txt
index c2634d5..8b48c04 100644
--- a/src/mock/CMakeLists.txt
+++ b/src/mock/CMakeLists.txt
@@ -1,8 +1,9 @@
SET(CURL_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/libcurl/libcurl.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/libcurl.c
)
add_library(mockcurl STATIC ${CURL_SOURCES})
+target_compile_options(mockcurl PUBLIC ${CFLAGS})
target_include_directories(mockcurl PUBLIC ${LIBCURL_INCLUDE_DIRS})
set(NAME ${CMAKE_PROJECT_NAME}_mock)
diff --git a/src/mock/libcurl/libcurl.c b/src/mock/libcurl.c
index b4f332c..95901be 100644
--- a/src/mock/libcurl/libcurl.c
+++ b/src/mock/libcurl.c
@@ -2,6 +2,8 @@
#include <stdarg.h>
#include <curl/curl.h>
+#include "../defines.h"
+
char* url = NULL;
void* data = NULL;
@@ -9,7 +11,7 @@ void* data = NULL;
#undef curl_easy_setopt
#endif
-CURLcode curl_global_init(long flags)
+CURLcode curl_global_init(UNUSED long flags)
{
puts("[MOCK] curl_global_init(...)");
return CURLE_OK;
@@ -21,7 +23,7 @@ CURL* curl_easy_init()
return NULL;
}
-CURLcode curl_easy_setopt(CURL *handle, CURLoption option, ...)
+CURLcode curl_easy_setopt(UNUSED CURL *handle, CURLoption option, ...)
{
puts("[MOCK] curl_easy_setopt(...)");
@@ -49,7 +51,7 @@ CURLcode curl_easy_setopt(CURL *handle, CURLoption option, ...)
return CURLE_OK;
}
-CURLcode curl_easy_perform(CURL *easy_handle)
+CURLcode curl_easy_perform(UNUSED CURL *easy_handle)
{
puts("[MOCK] curl_easy_perform(...)");
return CURLE_OK;
@@ -59,7 +61,7 @@ CURLcode curl_easy_perform(CURL *easy_handle)
#undef curl_easy_getinfo
#endif
-CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)
+CURLcode curl_easy_getinfo(UNUSED CURL *curl, CURLINFO info, ...)
{
puts("[MOCK] curl_easy_getinfo(...)");
@@ -76,7 +78,7 @@ CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)
return CURLE_OK;
}
-const char* curl_easy_strerror(CURLcode error)
+const char* curl_easy_strerror(UNUSED CURLcode error)
{
puts("[MOCK] curl_easy_strerror(...)");
return "error";