Commit Graph

56 Commits

Author SHA1 Message Date
sam-lunt
d3e37918e5 CMake refactor (#1510)
* Clean up CMake logic

- removed logic to find CppUnit (no longer used)
- removed "dirs" variable used to pass include directories
- removed add_library function (no longer used)
- removed make_executable function
    * only used in 2 places (polybar and polybar-msg)
    * it was more general than needed, logic is simpler without it
- split polybar into static library and executable
    * this allows linking unit tests to the library

* rename library

* add coverage build

- Added a CMake build type "Coverage" that builds C and C++
  code with the "--coverage" flag (recognized by both GCC and Clang)
- removed "-Wno-missing-field-initializers" from test flags,
  since it didn't seem to be needed any more
- removed logic from tests/CMakeLists to disable "-Werror" and "-pedantic-errors"
  since there didn't seem to be any warnings during the build

* fix whitespace

* update travis

* remove O2 from defalt flags

* allow tests to be built by default make target

* disable Werror for debug builds
2018-11-21 18:46:33 +01:00
patrick96
38f551f884 test(parser): Add tests for parse_action_cmd 2018-11-16 18:12:26 -08:00
patrick96
e794fe0d01 fix(gtest): prefer target_link_libraries
From commit 880896c6f4814f4c7798355a652dc6167be2b75f in googletest cmake
test configuration fails with errors like

CMake Error: install(EXPORT "gtestConfigInternal" ...) includes target
  "gtest" which requires target "i3ipc++" that is not in the export set.

The issue was that link_libraries also affected the googletest internal
targets that came after it making the whole thing fail.

This could also have been solved by moving link_libraries after the
configuration of googletest but according to the cmake documentation [1]
target_link_libraries should be prefered over link_libraries anyways.

[1]: https://cmake.org/cmake/help/latest/command/link_libraries.html

Fixes #1393
2018-08-31 13:17:19 -07:00
patrick96
58e269b2d6 refactor(test): Remove old testing harness
Now all tests have been converted to gtest and the old testing utility
code is not used anywhere
2018-07-31 13:20:27 -07:00
patrick96
9ec6682777 tests: Convert string tests to gtest
The sstream test was removed because it only tested standard library
behvaior
2018-07-30 14:12:22 +02:00
patrick96
a3786be26a tests: Disable -Werror for tests
This way we can still run tests with some compiler warnings
2018-07-30 14:12:22 +02:00
patrick96
0346a965a7 refactor(builder): No exception when maxlen < 3
The check of the maxlen and ellipsis condition was also moved to the
label creation, this way get_label_text doesn't need to care about the
restrictions placed on maxlen and ellipsis
2018-07-22 14:02:15 -07:00
patrick96
7dc42f543f fix(builder): Respect label-ellipsis option
This slightly changes the existing behavior of maxlen. Before with a
maxlen of 4 'abcde' used to yield 'abcd...' now it yields 'a...'
2018-07-22 14:02:15 -07:00
patrick96
4b83468eb9 refactor(builder): Add failing test for ellipsis
Adds failing tests for the bug described in #1194
2018-07-22 14:02:15 -07:00
patrick96
1965498e20 tests: Convert color test to gtest 2018-06-10 16:42:07 +02:00
patrick96
78680a6832 tests: Convert file test to gtest 2018-06-10 16:42:07 +02:00
patrick96
53c87558c9 tests: Convert scope test to gtest 2018-06-10 16:42:07 +02:00
patrick96
f983bb63bb tests: Convert math test to gtest 2018-06-10 16:42:07 +02:00
patrick96
cc9423e682 bar: Add geom_format_to_pixels tests 2018-05-10 00:05:18 +02:00
patrick96
553fde9499 fix(tests): Add forgotten scope test 2018-05-01 20:14:23 -07:00
patrick96
fce313f3ef tests: Fix clang build
Compiling gtest with clang fails with -Wmissing-field-initializers as
reported in [1]
[1]: https://github.com/google/googletest/issues/1521
2018-04-10 00:56:51 +02:00
patrick96
0e5584920b tests: Use local gtest headers
This makes sure the headers and the compiled gtest library are
compatible
2018-04-10 00:56:51 +02:00
patrick96
fa99be63a0 tests: Don't include src dir
Since we now link source files instead of including them, this is not
necessary anymore
2018-04-10 00:56:51 +02:00
patrick96
eb6159767b tests: Remove log message 2018-04-10 00:56:51 +02:00
patrick96
eed4d3ffc8 fix(tests): Compile gtest at configure time
Ubuntu (and thus travis CI) doesn't have the gtest library in its repos,
only the header files and according to [1], gtest should be compiled in
every project anyways

[1]: https://github.com/google/googletest/blob/master/googletest/docs/FAQ.md#why-is-it-not-recommended-to-install-a-pre-compiled-copy-of-google-test-for-example-into-usrlocal
2018-04-10 00:56:51 +02:00
patrick96
c865add821 refactor(tests): Migrate to googletest
googletest (gtest) is more feature rich than the current implementation
which only provides expect() which is basically an assertion. It is also
quite intuitive to use, this can be seen in the rewrite of the
command_line test where EXPECT_THROW replaces a whole try-catch block.

I have also moved the source files the test depend on to be linked in
CMakeLists.txt instead of including them directly because include .cpp
files is bad.

The two x11 tests were removed because they were written two years ago
and a lot of the things they depend on, don't actually exist anymore in
polybar (I think we switched to xpp after those tests were written)

Tests are now compiled with the gcov lib which can be used to provide
test coverage in a second step
2018-04-10 00:56:51 +02:00
Michael Carlberg
d3b0670f30 fix(config): Perform tilde expansion on include-file #603 2017-06-02 18:34:49 +02:00
Nicolò Balzarotti
84ee0d560c fs: Fix wrong size report 2017-03-13 10:21:21 +01:00
Michael Carlberg
beedc5ab84 fix(color_util): Parsing 2017-01-27 13:46:27 +01:00
Michael Carlberg
874e6b0d6c feat(config): Add directive for file inclusion 2017-01-26 20:10:33 +01:00
Michael Carlberg
43a17c3b36 refactor(cmake): Cleanup 2017-01-26 17:39:50 +01:00
Michael Carlberg
452afcdc68 refactor: Integral types 2017-01-24 07:11:14 +01:00
Michael Carlberg
9ce384b7e8 fix(ci): Update test 2017-01-14 10:02:44 +01:00
Michael Carlberg
e1dbd98c40 feat(string_util): Custom stringstream 2017-01-13 13:01:22 +01:00
Michael Carlberg
c2ac7fde67 refactor: Filesize strings 2017-01-12 20:28:44 +01:00
Michael Carlberg
5b33ada576 refactor(common): Cleanup 2017-01-11 07:17:54 +01:00
Michael Carlberg
c2bee14d34 fix(test): Use correct namespace 2017-01-11 05:05:11 +01:00
Michael Carlberg
5c9bfc147c fix(xbacklight): Lower inc/dec value to 5 and fix flooring 2017-01-11 04:40:10 +01:00
Michael Carlberg
6ce1c9805e refactor(tests): Use new factory methods 2016-12-15 19:05:26 +01:00
Michael Carlberg
c5bc338ae3 feat(math_util): Templated min/max 2016-11-26 13:09:29 +01:00
Michael Carlberg
84d58e7619 refactor: Cleanup handling of syntax tags 2016-11-25 04:34:24 +01:00
Michael Carlberg
3069202354 fix(tests): Patch color_util unit test 2016-11-22 01:38:03 +01:00
Michael Carlberg
2d66dc9a57 fix: Disable tests requiring X connection 2016-11-21 00:07:34 +01:00
Michael Carlberg
d6a5212ef3 fix(volume): Handle alsa playback range
Ref #174
2016-11-20 23:49:08 +01:00
Michael Carlberg
c6d85b2b92 refactor: Optimize build 2016-11-20 23:04:31 +01:00
Michael Carlberg
40fcabd644 fix(config): Proper dereference of ${self.key} 2016-11-19 19:18:28 +01:00
Michael Carlberg
489d429644 refactor(ci): Split into scripts 2016-11-19 12:23:02 +01:00
Michael Carlberg
b3df50082a fix(tests): Run unit tests on travis 2016-11-19 08:30:00 +01:00
Michael Carlberg
fd57ab0f3d fix: project rename 2016-11-19 06:26:07 +01:00
Michael Carlberg
e7cb345cec wip: Separate source from definitions 2016-11-03 12:54:32 +01:00
Michael Carlberg
26c308cc19 feat(color_util): Utility functions for color handling 2016-10-31 01:25:19 +01:00
Michael Carlberg
efba06dc2d fix(xft): Allocate xft color by value
- Solves the issue with transparency using Xft.
- X11 fonts are still affected by the alpha issue.

Closes jaagr/lemonbuddy#119
2016-10-30 02:37:56 +01:00
Michael Carlberg
bc67e64e79 feat: Add math_util::percentage_to_value 2016-10-25 07:05:01 +02:00
Michael Carlberg
769a3debe7 refactor(tests): Drop CppUnit 2016-10-25 01:47:00 +02:00
Michael Carlberg
37e367eb79 fix(string_util): Prevent replace_all lock 2016-10-19 01:31:17 +02:00