Include full c source to assert static objects
To assert static objects, we either have to add a method into the object under test itself and recompile on a test run with the activated test method (but also recompile after tests, so that method is gone on release builds). Alternatively we can include the whole .c file in our test infrastructure and save the object in the test directory. So there's no necessity to clean it up prior to a release build and it's contained away. This requires, that the test folder isn't excluded in coveralls.
This commit is contained in:
parent
b4c319350a
commit
2e9d8300de
@ -33,7 +33,7 @@ matrix:
|
|||||||
include:
|
include:
|
||||||
- compiler: gcc
|
- compiler: gcc
|
||||||
after_success:
|
after_success:
|
||||||
- coveralls --exclude 'test'
|
- coveralls
|
||||||
- compiler: clang
|
- compiler: clang
|
||||||
after_success:
|
after_success:
|
||||||
- coveralls --exclude 'test' --gcov llvm-cov --gcov-options gcov
|
- coveralls --gcov llvm-cov --gcov-options gcov
|
||||||
|
5
Makefile
5
Makefile
@ -96,8 +96,11 @@ test-coverage-report: test-coverage
|
|||||||
--html-details \
|
--html-details \
|
||||||
-o docs/internal/coverage/index.html
|
-o docs/internal/coverage/index.html
|
||||||
|
|
||||||
|
test/%.o: test/%.c src/%.c
|
||||||
|
${CC} -o $@ -c $< ${CFLAGS}
|
||||||
|
|
||||||
test/test: ${OBJ} ${TEST_OBJ}
|
test/test: ${OBJ} ${TEST_OBJ}
|
||||||
${CC} -o ${@} ${TEST_OBJ} ${OBJ} ${CFLAGS} ${LDFLAGS}
|
${CC} -o ${@} ${TEST_OBJ} $(filter-out ${TEST_OBJ:test/%=src/%},${OBJ}) ${CFLAGS} ${LDFLAGS}
|
||||||
|
|
||||||
.PHONY: doc doc-doxygen
|
.PHONY: doc doc-doxygen
|
||||||
doc: docs/dunst.1
|
doc: docs/dunst.1
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
|
#include "../src/icon.c"
|
||||||
#include "greatest.h"
|
#include "greatest.h"
|
||||||
#include "../src/icon.h"
|
|
||||||
#include "../src/utils.h"
|
|
||||||
|
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
#define ICONPREFIX "/data/icons/path"
|
#define ICONPREFIX "/data/icons/path"
|
||||||
|
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
|
#include "src/markup.c"
|
||||||
#include "greatest.h"
|
#include "greatest.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
#include "src/markup.h"
|
|
||||||
|
|
||||||
TEST test_markup_strip(void)
|
TEST test_markup_strip(void)
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
|
#include "src/notification.c"
|
||||||
#include "greatest.h"
|
#include "greatest.h"
|
||||||
#include "src/notification.h"
|
|
||||||
#include "src/option_parser.h"
|
#include "src/option_parser.h"
|
||||||
#include "src/settings.h"
|
#include "src/settings.h"
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
TEST test_notification_is_duplicate_field(char **field,
|
TEST test_notification_is_duplicate_field(char **field,
|
||||||
struct notification *a,
|
struct notification *a,
|
||||||
struct notification *b)
|
struct notification *b)
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
|
#include "src/option_parser.c"
|
||||||
#include "greatest.h"
|
#include "greatest.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
#include "src/option_parser.h"
|
|
||||||
|
|
||||||
TEST test_next_section(void)
|
TEST test_next_section(void)
|
||||||
{
|
{
|
||||||
const char *section = NULL;
|
const char *section = NULL;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
|
#include "src/utils.c"
|
||||||
#include "greatest.h"
|
#include "greatest.h"
|
||||||
#include "src/utils.h"
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
TEST test_string_replace_char(void)
|
TEST test_string_replace_char(void)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user