-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multiline matching of stdout/stderr doesn't work as expected (cannot achieve it) #29
Comments
Sorry I'm not sure - needs debugging. Perhaps we are not calling it in multiline mode. |
It is called in multiline mode. But regex-tdfa has a non-standard multiline mode that combines what is usually known as "multiline" with inverse "dotall" and also disables matching newlines in inverted character classes (so you can't even use e.g. You can match a newline using |
Also: fyi |
regex-tdfa does recognise
|
The behaviour of |
@obfusk Thanks for the infos, very useful. As for the What I didn't 100% understand is whether we should abandon the expectation to handle newlines in a standard way completely due to inherent limitations of |
You could (add an option to shelltestrunner to) turn multiline mode off; this allows you to match newlines with It's unfortunate that Another option would be to (have an option to) "preprocess" the regex and replace |
Worth raising in regex-tdfa's issue tracker maybe ?
|
|
@simonmichael |
@ppenguin fwiw I recently quickly hacked together a Python implementation of something similar to shelltest. It's unfinished, not entirely compatible, only implements part of the functionality,
Note the |
I would very much like this. I am currently porting my application from python to haskell and I dearly miss the integrated test generation ("transcript") of https://github.com/python-cmd2/cmd2 where you can save the output of the application in order to test it at a later date. I've just written one test with shelltestrunner but due to the size of the output it would be too impractical to maintain those transcripts manually. I mention this because it can be an inspiration for line handling too. NB: I also find the |
Would anybody like to propose/work on some improvements ? |
Couldn't this problem (easy multiline matching) be solved by allowing multiple regexes per file descriptor? At least assuming that order of lines is not important. I.e. I'm thinking of
And one would need to resort to proper multiline matching only if specific order is needed. |
Some years ago, regex-tdfa was the best compromise of power and portability. Is there anything better (more standard, more robust) nowadays ? |
When testing this, it matches:
but when testing this, it doesn't (returns failure):
the
regex.TDFA
matcher is supposed to default to multiline, so I'd expect that one to work. But even if I explicitly try to include newlines for the catch-all, it doesn't work as well (also returns failure):Is there a syntax I can use to achieve multiline matching as-is, or does it require a mod to the code?
The text was updated successfully, but these errors were encountered: