Re: [PATCH 3/5] lib/tests: string_helpers: introduce test_string_unescape_one
From: Andy Shevchenko
Date: Thu Sep 17 2026 - 05:12:09 EST
On Thu, Sep 17, 2026 at 10:58:27AM +0200, Jonas Rebmann wrote:
> On 2026-09-17 09:21, Andy Shevchenko wrote:
> > On Wed, Sep 16, 2026 at 07:38:08PM +0200, Jonas Rebmann wrote:
> > > The existing test_string_unescape() function follows a complex procedure
> > > where it, given a set of UNESCAPE flags, appends multiple test fragments
> > > and predicts their unescape result for the chosen set of flags. Rename
> > > test_string_unescape() to a more descriptive
> > > test_string_unescape_combined
> > >
> > > In preparation to add simple regression tests, introduce
> > > test_string_unescape_one() which asserts on exactly one call to
> > > string_unescape.
> > >
> > > Add some tests for corner cases which already pass.
> >
> > So, this is two-in-one patch change. Needs a split, but I'm not sure why
> > we even need this. Can't your case be incorporated into the existing
> > "combined" variant?
>
> They can not be incorporated into the combined variant because that
> makes it impossible to control the size of the destination buffer. This
> can not be fixed because the idea of the combined test is that all test
> strings are combined into one buffer. The bugs fixed in this series only
> occur when the destination buffer is limited.
We may modify the loop to provide the length of the destination buffer to be
exactly what we expect, no?
> Furthermore, for the regression tests, I want each test tailored for a
> specific case and when it fails, to show me which one failed.
> I'll update the commit message and split the commit.
--
With Best Regards,
Andy Shevchenko