From: Rasmus Villemoes Date: Tue, 13 May 2025 08:40:33 +0000 (+0200) Subject: test: slre: add tests for character ranges X-Git-Tag: v2025.10-rc1~118^2~67^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de6e54d74dec9da5d7b8572d5a0711c7280eae2c;p=thirdparty%2Fu-boot.git test: slre: add tests for character ranges The first of these, { "U-Boot", "^[B-Uo-t]*$", 0 }, would match previously when the - and the letters were all interpreted literally. Reviewed-by: Simon Glass Signed-off-by: Rasmus Villemoes --- diff --git a/test/lib/slre.c b/test/lib/slre.c index 053d046075e..ff2386d614a 100644 --- a/test/lib/slre.c +++ b/test/lib/slre.c @@ -29,6 +29,14 @@ static const struct re_test re_test[] = { /* DIGIT is 17 */ { "##\x11%%\x11", "^[#%\\d]*$", 0 }, { "##23%%45", "^[#%\\d]*$", 1 }, + { "U-Boot", "^[B-Uo-t]*$", 0 }, + { "U-Boot", "^[A-Zm-v-]*$", 1 }, + { "U-Boot", "^[-A-Za-z]*$", 1 }, + /* The range --C covers both - and B. */ + { "U-Boot", "^[--CUot]*$", 1 }, + { "U-Boot", "^[^0-9]*$", 1 }, + { "U-Boot", "^[^0-9<->]*$", 1 }, + { "U-Boot", "^[^0-9<\\->]*$", 0 }, {} };