tests: Add test for pattern match failure.
src: Make <==> more robust.