Issue #27 open

Support multiline regex

Anonymous created an issue

I want to use a regex such as :

(?m)No problems found. (re)

to match output with a variable number of lines, such as:

Warning 1: foo Warning 1: foobaz ... Warning N: foobar No problems found.

I tested the regex with python's re module.

Is the regex given all of the unconsumed output text, or just one line of it?

Comments (4)

  1. Brodie Rao staff repo owner

    Cram does its diffing/matching on a line by line basis. I'm not sure how I'd implement support for something like this, but it does sound like it could be useful.

    I'll revisit this issue if I come up with any ideas. If you have any, let me know!

  2. Sietse Brouwer

    What about a marker (...) that is treated as follows:

    • next-pattern is the pattern on the next testfile line
    • peek at the next output line
    • if the peeked output line does match next-pattern, stop consuming lines (leaving the next line to be consumed by the next pattern)
    • if the peeked output line does not match next-pattern, consume it
    • if there is no next line, fail the test.

    NB: this advice given without looking at cram's source code, so it may not match the execution model. I'll return later and look at the source code in order to give more informed advice.

  3. Log in to comment