aiiie / cram

Functional tests for command line applications
GNU General Public License v2.0
199 stars 51 forks source link

Don't require whitespace on blank lines #3

Open sourcefrog opened 9 years ago

sourcefrog commented 9 years ago

cram sometimes requires trailing whitespace, which causes unfortunate conflicts with trees or editors set up to strip them.

The main case I notice is blank spaces occurring in the middle of output blocks. cram wants them to have ^ $ so that they're indented to the same point. It seems like that could be ignored without much loss of sensitivity.

sourcefrog commented 9 years ago

I could probably send you a patch for this if it's acceptable in principle.

pnathan commented 9 years ago

:+1:

roman-neuhauser commented 7 years ago

wouldn't that create an ambiguity?

sourcefrog commented 7 years ago

I think not, but there might be some difficult cases.

This command prints _n_ blank lines:

  $ print_blank_lines 4

Pretty neat!

I think you could potentially fix that by saying the document is composed of paragraphs separated by single blank lines, and each paragraph is an example if the nonblank lines all have >=2 spaces. Then, the middle paragraph of this example contains 4 blank lines at the end.

I tried a patch for this years ago but found the parser code hard to change.