aiiie / cram

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

Mark output lines as optional #20

Open Flimm opened 7 years ago

Flimm commented 7 years ago

I would like to be able to write this code:

  $ command
  Good morning (optional)
  Hello.

I expect the command being tested to either output "Good morning\nHello.\n" or "Hello.\n". I don't see how this is possible, but an (optional) option would be very useful.

This is related to #14 .

roman-neuhauser commented 4 years ago

What if you have multiple optional lines?

$ command
one (opt)
two (opt)
three (opt)
four (opt)

Should they be optional independently, or en bloc? IOW, is it ok for command to output eg.

two
four

Perhaps worse, what would the diff look like here?

$ command
one
two (opt)
three

Actual output:

one
twenty
three