Add test for nerd font icons that are outside the private use areas
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
This commit is contained in:
10
Makefile
10
Makefile
@@ -12,7 +12,7 @@ EXTERNAL_SERVICES:=1
|
||||
|
||||
SCDOC=scdoc
|
||||
|
||||
.PHONY: install shellcheck
|
||||
.PHONY: install test shellcheck test_legacy_nerdfont
|
||||
|
||||
VERSION:=1.13.0
|
||||
|
||||
@@ -33,11 +33,17 @@ docs/%: docs/%.scd
|
||||
|
||||
all: $(PROGRAMS) $(DOCS)
|
||||
|
||||
test: shellcheck
|
||||
test: shellcheck test_legacy_nerdfont
|
||||
|
||||
shellcheck:
|
||||
find . -type f -name '*.sh' -print0 | xargs -0 shellcheck -x --shell=sh
|
||||
|
||||
test_legacy_nerdfont: programs/test_legacy_nerdfont
|
||||
programs/test_legacy_nerdfont < configs/default_hooks/sxmo_hook_icons.sh
|
||||
|
||||
programs/test_legacy_nerdfont: programs/test_legacy_nerdfont.c
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $< $(shell pkg-config --cflags --libs icu-io)
|
||||
|
||||
programs/%: programs/%.c
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $<
|
||||
|
||||
|
32
programs/test_legacy_nerdfont.c
Normal file
32
programs/test_legacy_nerdfont.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <unicode/ustdio.h>
|
||||
#include <unicode/ubidi.h>
|
||||
|
||||
int main() {
|
||||
UFILE *in = u_finit(stdin, NULL, NULL);
|
||||
int line = 1;
|
||||
int err = 0;
|
||||
bool comment = false;
|
||||
|
||||
while (true) {
|
||||
UChar chr = u_fgetc(in);
|
||||
if (chr == U_EOF) {
|
||||
break;
|
||||
} if (chr == '\n') {
|
||||
line++;
|
||||
comment = false;
|
||||
continue;
|
||||
} if (chr == '#') {
|
||||
comment = true;
|
||||
}
|
||||
|
||||
if (comment)
|
||||
continue;
|
||||
|
||||
if (chr >= 0xF900 && chr <= 0xFDFF) {
|
||||
u_printf("ERROR: detected legacy nerd font icon in wrong characer range: \"%C\" 0x%x on line %d\n", chr, chr, line);
|
||||
err = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
Reference in New Issue
Block a user