byexample icon indicating copy to clipboard operation
byexample copied to clipboard

Ignore empty space at the begin of the `got` string even if the `expected` does not use `<...>`

Open eldipa opened this issue 3 years ago • 0 comments

Describe the feature you'd like It is not uncommon to have a code that outputs one or more empty lines at the begin of stream before writing anything else.

Because byexample requires non-empty lines in the expected string, the user must or use <...> or +rm=~ plus possibly +norm-ws.

This obviously is annoying.

The proposal is to ignore any empty line (with or without spaces) at the begin of the got.

Additional context (optional) Considerations:

>>> print("\n  \nSome line") # should work as it is correct
<...>
Some line

>>> print("\n  \nSome line") # should work as it is correct
<...>Some line

>>> print("\n  \nSome line") # should work too (empty lines skipped) 
Some line
>>> print("\n  \n  Some line") # should fail (missing indentation)
<...>
Some line

>>> print("\n  \n  Some line") # should work as it is correct
<...>Some line

>>> print("\n  \n  Some line") # should fail (missing indentation) 
Some line
>>> print("\n  \n  Some line") # +norm-ws should work
<...>
Some line

>>> print("\n  \n  Some line") # +norm-ws should work
<...>Some line

>>> print("\n  \n  Some line")  # +norm-ws should work 
Some line

eldipa avatar Nov 15 '22 00:11 eldipa