← Back to index

lib/BDD/Behave/Matcher/Boolean.rakumod

17 / 21 lines covered (81.0%)

1unit module BDD::Behave::Matcher::Boolean;23use BDD::Behave::Matcher;45class BeTruthyMatcher does Matcher is export {6  method matches($actual --> Bool) {7    ?$actual;8  }910  method failure-message($actual --> Str) {11    "expected " ~ $actual.raku ~ " to be truthy";12  }1314  method failure-message-negated($actual --> Str) {15    "expected " ~ $actual.raku ~ " not to be truthy";16  }1718  method description(--> Str) { 'be truthy' }19}2021class BeFalsyMatcher does Matcher is export {22  method matches($actual --> Bool) {23    !$actual;24  }2526  method failure-message($actual --> Str) {27    "expected " ~ $actual.raku ~ " to be falsy";28  }2930  method failure-message-negated($actual --> Str) {31    "expected " ~ $actual.raku ~ " not to be falsy";32  }3334  method description(--> Str) { 'be falsy' }35}3637class BeNilMatcher does Matcher is export {38  method matches($actual --> Bool) {39    !$actual.defined;40  }4142  method failure-message($actual --> Str) {43    "expected " ~ $actual.raku ~ " to be nil";44  }4546  method failure-message-negated($actual --> Str) {47    "expected " ~ $actual.raku ~ " not to be nil";48  }4950  method description(--> Str) { 'be nil' }51}