xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit 4c7ff9716a1911898cbcdd3ea4a3c57a73d00bb2

Improve printing of multiline strings in stic
Python-style string literals:

Expected
"""
line1
line2
line3
"""
but was <NULL>

Instead of

Expected "line1
line2
line3
" but was <NULL>

Still not perfect as one can't see where each line ends but it's an
improvement (much easier to read and compare values visually).
Author: xaizek
Author date (UTC): 2026-06-17 16:55
Committer name: xaizek
Committer date (UTC): 2026-07-11 12:48
Parent(s): 5f8e71039fb0a1ec6a33855fa38c3585c344e4d3
Signing key: 99DC5E4DB05F6BE2
Tree: 0ff69d2bb39962e4ffcfdfa670f45cb1454b9e91
File Lines added Lines deleted
tests/test-support/stic/stic.c 20 6
File tests/test-support/stic/stic.c changed (mode: 100644) (index 7c6a9007c..330c14045)
... ... void stic_assert_string_equal(const char* expected, const char* actual, const ch
342 342 { {
343 343 int comparison; int comparison;
344 344 char s[STIC_PRINT_BUFFER_SIZE]; char s[STIC_PRINT_BUFFER_SIZE];
345 const char *quote;
346
347 quote = "\"";
348 if ((actual != NULL && strchr(actual, '\n') != NULL) || (expected != NULL && strchr(expected, '\n') != NULL))
349 {
350 quote = "\n\"\"\"\n";
351 }
345 352
346 353 if ((expected == (char *)0) && (actual == (char *)0)) if ((expected == (char *)0) && (actual == (char *)0))
347 354 { {
 
... ... void stic_assert_string_equal(const char* expected, const char* actual, const ch
350 357 } }
351 358 else if (expected == (char *)0) else if (expected == (char *)0)
352 359 { {
353 snprintf(s, sizeof(s), "Expected <NULL> but was \"%s\"", actual);
360 snprintf(s, sizeof(s), "Expected <NULL> but was %s%s%s", quote, actual, quote);
354 361 comparison = 0; comparison = 0;
355 362 } }
356 363 else if (actual == (char *)0) else if (actual == (char *)0)
357 364 { {
358 snprintf(s, sizeof(s), "Expected \"%s\" but was <NULL>", expected);
365 snprintf(s, sizeof(s), "Expected %s%s%s but was <NULL>", quote, expected, quote);
359 366 comparison = 0; comparison = 0;
360 367 } }
361 368 else else
362 369 { {
363 370 comparison = strcmp(expected, actual) == 0; comparison = strcmp(expected, actual) == 0;
364 snprintf(s, sizeof(s), "Expected \"%s\" but was \"%s\"", expected, actual);
371 snprintf(s, sizeof(s), "Expected %s%s%s but was %s%s%s", quote, expected, quote, quote, actual, quote);
365 372 } }
366 373
367 374 stic_simple_test_result(comparison, s, function, file, line); stic_simple_test_result(comparison, s, function, file, line);
 
... ... void stic_assert_wstring_equal(const wchar_t expected[], const wchar_t actual[],
371 378 { {
372 379 int comparison; int comparison;
373 380 char s[STIC_PRINT_BUFFER_SIZE]; char s[STIC_PRINT_BUFFER_SIZE];
381 const char *quote;
382
383 quote = "\"";
384 if ((actual != NULL && wcschr(actual, L'\n') != NULL) || (expected != NULL && wcschr(expected, L'\n') != NULL))
385 {
386 quote = "\n\"\"\"\n";
387 }
374 388
375 389 if ((expected == NULL) && (actual == NULL)) if ((expected == NULL) && (actual == NULL))
376 390 { {
 
... ... void stic_assert_wstring_equal(const wchar_t expected[], const wchar_t actual[],
380 394 else if (expected == NULL) else if (expected == NULL)
381 395 { {
382 396 #ifdef STIC_C99 #ifdef STIC_C99
383 snprintf(s, sizeof(s), "Expected <NULL> but was \"%ls\"", actual);
397 snprintf(s, sizeof(s), "Expected <NULL> but was %s%ls%s", quote, actual, quote);
384 398 #else #else
385 399 snprintf(s, sizeof(s), "Expected <NULL> but was wide string"); snprintf(s, sizeof(s), "Expected <NULL> but was wide string");
386 400 #endif #endif
 
... ... void stic_assert_wstring_equal(const wchar_t expected[], const wchar_t actual[],
389 403 else if (actual == NULL) else if (actual == NULL)
390 404 { {
391 405 #ifdef STIC_C99 #ifdef STIC_C99
392 snprintf(s, sizeof(s), "Expected \"%ls\" but was <NULL>", expected);
406 snprintf(s, sizeof(s), "Expected %s%ls%s but was <NULL>", quote, expected, quote);
393 407 #else #else
394 408 snprintf(s, sizeof(s), "Expected wide string but was <NULL>"); snprintf(s, sizeof(s), "Expected wide string but was <NULL>");
395 409 #endif #endif
 
... ... void stic_assert_wstring_equal(const wchar_t expected[], const wchar_t actual[],
399 413 { {
400 414 comparison = wcscmp(expected, actual) == 0; comparison = wcscmp(expected, actual) == 0;
401 415 #ifdef STIC_C99 #ifdef STIC_C99
402 snprintf(s, sizeof(s), "Expected \"%ls\" but was \"%ls\"", expected, actual);
416 snprintf(s, sizeof(s), "Expected %s%ls%s but was %s%ls%s", quote, expected, quote, quote, actual, quote);
403 417 #else #else
404 418 snprintf(s, sizeof(s), "Expected wide string doesn't match"); snprintf(s, sizeof(s), "Expected wide string doesn't match");
405 419 #endif #endif
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master