I’ve recently released version 2.0.1 of Expect for .NET library. In this post you will find list of changes, what unexpected behavior was fixed and next release announcement.
Changelog
The only change is fix of matching mechanism used to find expected string in output. Previous versions used regular expressions matching. Because there was not a word about it in documentation, blog posts or tutorials the matching mechanism produced unexpected results when there were used special characters like ‘*’, ‘?’, ‘$’, ‘.’, etc. I decided that this is bug and fixed it in this version.
Fixed unexpected behavior
Previous versions used regular expressions matching so some characters had special meanings. Below is table presenting differences:
Expected string | Received output | version 2.0.0 result |
version 2.0.1 result |
Comment |
---|---|---|---|---|
“user@host:~$” | “user@host:~$ “. | not match | match | $ in regular expressions means end of string |
@”user@host:~\$” | “user@host:~$ “. | match | not match | \$ in regular expressions means $ |
“.*” | “some text” | match | not match | .* in regular expressions means any string |
So as presented in table some expected strings gave really unexpected results.
What about regular expressions?
Some of you may ask this question now. If you used this hidden and unplanned feature till now, please don’t upgrade to version 2.0.1 and… wait for version 2.1.0.
Yes. In version 2.1.0 will be added dedicated functionality to support regular expressions. Code is already written, tests are passing. I have to review code and release it. So you can expect it soon. If you can’t wait, you can look at ‘regex’ branch here: https://github.com/wiwanek/Expect.NET/tree/regex
How to get version 2.0.1?
It’s avaialable via NuGet: https://www.nuget.org/packages/Expect.NET/
and on GitHub: https://github.com/wiwanek/Expect.NET/releases/tag/v2.0.1
What features would you like to see after regular expression support? Share your thought in comments.
Leave a comment