You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know this is work in progress, but figured I share this - worst case: gets closed :)
Pre-requisites: some HTTP server, e.g. docker run -p 8081:80 nginx for quick test.
The data we're looking at for ref is:
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
step: assumed this is a standalone line with ^...$, but it's not.
It would be awesome if all of these passed. The key usecase is validating data from an endpoint with regexp, and expecting ^ and $ at our disposal to clearly mark line start/end.
As a workaround, assertions like this are possible, but not too elegant: - result.body ShouldMatchRegex '\n<html>\n'.
Also, please let me know if I'm misinterpreting the doc, happy to be corrected here.
Thanks,
mb
The text was updated successfully, but these errors were encountered:
miklosbagi
changed the title
[bug] regex assertion for multiline data is broken
Regex assertion for multiline data is broken (go ?m flag helps)
Jul 14, 2023
@theUm pointed out that this is actually how it works with standard go regexp, and so a multiline flag (?m) is needed to enable this.
The following works fine:
Howdy,
I know this is work in progress, but figured I share this - worst case: gets closed :)
Pre-requisites: some HTTP server, e.g.
docker run -p 8081:80 nginx
for quick test.The data we're looking at for ref is:
Example test case:
It would be awesome if all of these passed. The key usecase is validating data from an endpoint with regexp, and expecting ^ and $ at our disposal to clearly mark line start/end.
As a workaround, assertions like this are possible, but not too elegant:
- result.body ShouldMatchRegex '\n<html>\n'
.Also, please let me know if I'm misinterpreting the doc, happy to be corrected here.
Thanks,
mb
The text was updated successfully, but these errors were encountered: