Test version number in unittests
Enforces a version number as intended in the Makefile. This check is necessary, as there is no ability to check via Macros for an empty string.
This commit is contained in:
parent
27c6a1682d
commit
eba6913faa
@ -18,6 +18,9 @@ dist: trusty
|
|||||||
sudo: false
|
sudo: false
|
||||||
language: c
|
language: c
|
||||||
|
|
||||||
|
git:
|
||||||
|
depth: false
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- pip install --user cpp-coveralls
|
- pip install --user cpp-coveralls
|
||||||
|
|
||||||
|
@ -22,10 +22,6 @@
|
|||||||
#include "x11/screen.h"
|
#include "x11/screen.h"
|
||||||
#include "x11/x.h"
|
#include "x11/x.h"
|
||||||
|
|
||||||
#ifndef VERSION
|
|
||||||
#define VERSION "version info needed"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* index of colors fit to urgency level */
|
/* index of colors fit to urgency level */
|
||||||
|
|
||||||
GMainLoop *mainloop = NULL;
|
GMainLoop *mainloop = NULL;
|
||||||
|
21
test/misc.c
Normal file
21
test/misc.c
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "greatest.h"
|
||||||
|
|
||||||
|
// This actually tests the buildsystem to make sure,
|
||||||
|
// the build system hands over a correct version number
|
||||||
|
// This is not testable via macros
|
||||||
|
TEST assert_version_number(void)
|
||||||
|
{
|
||||||
|
ASSERTm("Version number is empty",
|
||||||
|
0 != strcmp(VERSION, ""));
|
||||||
|
|
||||||
|
ASSERTm("Version number is not seeded by git",
|
||||||
|
NULL == strstr(VERSION, "non-git"));
|
||||||
|
PASS();
|
||||||
|
}
|
||||||
|
|
||||||
|
SUITE(suite_misc)
|
||||||
|
{
|
||||||
|
RUN_TEST(assert_version_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */
|
@ -8,6 +8,7 @@ SUITE_EXTERN(suite_utils);
|
|||||||
SUITE_EXTERN(suite_option_parser);
|
SUITE_EXTERN(suite_option_parser);
|
||||||
SUITE_EXTERN(suite_notification);
|
SUITE_EXTERN(suite_notification);
|
||||||
SUITE_EXTERN(suite_markup);
|
SUITE_EXTERN(suite_markup);
|
||||||
|
SUITE_EXTERN(suite_misc);
|
||||||
SUITE_EXTERN(suite_icon);
|
SUITE_EXTERN(suite_icon);
|
||||||
|
|
||||||
GREATEST_MAIN_DEFS();
|
GREATEST_MAIN_DEFS();
|
||||||
@ -21,6 +22,7 @@ int main(int argc, char *argv[]) {
|
|||||||
RUN_SUITE(suite_option_parser);
|
RUN_SUITE(suite_option_parser);
|
||||||
RUN_SUITE(suite_notification);
|
RUN_SUITE(suite_notification);
|
||||||
RUN_SUITE(suite_markup);
|
RUN_SUITE(suite_markup);
|
||||||
|
RUN_SUITE(suite_misc);
|
||||||
RUN_SUITE(suite_icon);
|
RUN_SUITE(suite_icon);
|
||||||
GREATEST_MAIN_END();
|
GREATEST_MAIN_END();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user