test(iconset): Add failing fuzzy match test

Ref: #2041
This commit is contained in:
patrick96 2020-03-19 15:01:56 +01:00 committed by Patrick Ziegler
parent 853ea994bb
commit 3f7eb1b2aa
2 changed files with 19 additions and 0 deletions

View File

@ -58,6 +58,7 @@ add_unit_test(components/bar)
add_unit_test(components/parser)
add_unit_test(components/config_parser)
add_unit_test(drawtypes/label)
add_unit_test(drawtypes/iconset)
# Run make check to build and run all unit tests
add_custom_target(check

View File

@ -0,0 +1,18 @@
#include "drawtypes/iconset.hpp"
#include "common/test.hpp"
using namespace std;
using namespace polybar;
using namespace polybar::drawtypes;
TEST(IconSet, fuzzyMatchExactMatchFirst) {
iconset_t icons = make_shared<iconset>();
icons->add("1", make_shared<label>("1"));
icons->add("10", make_shared<label>("10"));
label_t ret = icons->get("10", "", true);
EXPECT_EQ("10", ret->get());
}