When merging #1445 we found that the results could be improved.
I promised to fix the deficient results along with proper unit tests so here we go.
Basically utils_strv_shorten_file_list() can repaired and simplified at the same time by a relatively minor change to the supprting utils_strv_find_lcs(). This is all backed up by new unit tests which tests the related functions plus (now reborn) utils_strv_new(). You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/2262
-- Commit Summary --
* tests: unit test for some util strv functions * utils: refactor utils_strv_shorten_file_list() and friends * utils: fix suboptimal elipsis substitution by utils_strv_shorten_file_list() * utils: move utils_strv_shorten_file_list() out of GEANY_PRIVATE
-- File Changes --
M src/utils.c (129) M src/utils.h (6) M tests/Makefile.am (11) A tests/test_utils.c (419)
-- Patch Links --
https://github.com/geany/geany/pull/2262.patch https://github.com/geany/geany/pull/2262.diff
@kugel- pushed 1 commit.
c31e17cb5365874380185ee9ab34af2b4dfbc5de fixup! tests: unit test for some util strv functions
@elextr @b4n @ntrel @codebrainz ping
Since it's fixing bugs and not introducing a potentially controversial new feature, I don't want this to rot long on github. Please review or I'll go ahead and merge anyway in a few days/weeks
Almost 4 weeks passed, I'll go ahead.
Merged #2262 into master.
BTW with `-Wextra` I get: ``` utils.c: In function 'utils_strv_shorten_file_list': utils.c:2192:2: warning: "/*" within comment [-Wcomment] 2192 | /* We only want to strip full path components, including the trailing slash. ```
github-comments@lists.geany.org