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:
ArenM
2023-04-04 22:42:25 -04:00
committed by Willow Barraco
parent 819c5fad58
commit b8c42390be
2 changed files with 40 additions and 2 deletions

View File

@@ -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 $@ $<

View 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;
}