diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-04 14:57:22 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-04 14:57:22 -0400 |
| commit | 7a649b145e95c5450d9454e9d4b0d94e2459fdea (patch) | |
| tree | 8573f85cad17bb1b3ca603ebd5b1a4bf7601ef71 | |
| parent | ff4ea60daf8a97d07a5b0419c05441d7312a1901 (diff) | |
Bugfix for tests
| -rw-r--r-- | builtins/functions.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/builtins/functions.c b/builtins/functions.c index 46e27c62..47350814 100644 --- a/builtins/functions.c +++ b/builtins/functions.c @@ -202,20 +202,10 @@ public void end_test(void *expr, const TypeInfo *type, CORD expected, const char CORD expr_cord = generic_as_text(expr, USE_COLOR, type); CORD type_name = generic_as_text(NULL, false, type); - uint8_t buf[512] = {0}; - size_t buf_len = sizeof(buf)-1; - const char *expr_str = CORD_to_const_char_star(expr_cord); - uint8_t *normalized_str = u8_normalize(UNINORM_NFD, (uint8_t*)expr_str, strlen(expr_str), buf, &buf_len); - normalized_str[buf_len] = 0; - if (!normalized_str) errx(1, "Couldn't normalize unicode string!"); - CORD expr_normalized = CORD_from_char_star((char*)normalized_str); - if (normalized_str != buf) - free(normalized_str); - for (int i = 0; i < 3*TEST_DEPTH; i++) fputc(' ', stderr); - CORD_fprintf(stderr, USE_COLOR ? "\x1b[2m=\x1b[0m %r \x1b[2m: %r\x1b[m\n" : "= %r : %r\n", expr_normalized, type_name); + CORD_fprintf(stderr, USE_COLOR ? "\x1b[2m=\x1b[0m %r \x1b[2m: %r\x1b[m\n" : "= %r : %r\n", expr_cord, type_name); if (expected) { - CORD expr_plain = USE_COLOR ? generic_as_text(expr, false, type) : expr_normalized; + CORD expr_plain = USE_COLOR ? generic_as_text(expr, false, type) : expr_cord; bool success = Text$equal(&expr_plain, &expected); if (!success && CORD_chr(expected, 0, ':')) { CORD with_type = CORD_catn(3, expr_plain, " : ", type_name); @@ -227,7 +217,7 @@ public void end_test(void *expr, const TypeInfo *type, CORD expected, const char USE_COLOR ? "\n\x1b[31;7m ==================== TEST FAILED ==================== \x1b[0;1m\n\nExpected: \x1b[1;32m%s\x1b[0m\n\x1b[1m But got:\x1b[m %s\n\n" : "\n==================== TEST FAILED ====================\nExpected: %s\n\n But got: %s\n\n", - CORD_to_const_char_star(expected), CORD_to_const_char_star(expr_normalized)); + CORD_to_const_char_star(expected), CORD_to_const_char_star(expr_cord)); print_stack_trace(stderr); fflush(stderr); |
