Closed tkirill closed 9 years ago
I wouldn't worry about this too much, as the Should Contain
operator is pretty much on everyone's "get rid of this" list (or at least rename it). They want Should Contain
to correspond to PowerShell's -contains
operator, which is for searching arrays, not doing partial matches in files.
@dlwyatt Does Pester have an alternative to Should Contain
already? At the moment I use a workaround with Get-Content
and Should Be
.
That's what I would do. (Or Should Match
, etc, but I'd start out with Get-Content
.)
@dlwyatt Anyway, here is PR #378. It fixes this small issue and I think doesn't makes anything worse.
This test fails:
Likely other assertions have this problem too. I see two ways to fix this:
-Encoding
option forContain
assertion and for other assertions if needed.I like first option because it works for almost everyone, it is simple and intuitive and it has backward compatibility with ASCII. Also, it is trivial to implement if I don't miss some hidden difficulties.
Second option is more flexible but it is a question if somebody will ever need this flexibility.