← Back to index

lib/BDD/Behave/Matcher/String.rakumod

10 / 10 lines covered (100.0%)

1unit module BDD::Behave::Matcher::String;23use BDD::Behave::Matcher;45class MatchMatcher does Matcher is export {6  has Regex $.expected is required;78  method matches($actual --> Bool) {9    return False unless $actual.defined;10    return False unless $actual ~~ Str;11    ?($actual ~~ $!expected);12  }1314  method failure-message($actual --> Str) {15    "expected " ~ $actual.raku ~ " to match " ~ $!expected.raku;16  }1718  method failure-message-negated($actual --> Str) {19    "expected " ~ $actual.raku ~ " not to match " ~ $!expected.raku;20  }2122  method expected-value(--> Mu) { $!expected }2324  method description(--> Str) { 'match ' ~ $!expected.raku }25}