← Back to index

lib/BDD/Behave/Formatter/Documentation.rakumod

31 / 32 lines covered (96.9%)

1use BDD::Behave::Colors;2use BDD::Behave::Failures;3use BDD::Behave::Formatter;4use BDD::Behave::Formatter::Tree;56unit class BDD::Behave::Formatter::Documentation is BDD::Behave::Formatter::Tree;78has Int $!indent = 0;9has Bool $!multi-file = False;1011method name(--> Str) { 'documentation' }1213method !prefix(--> Str) {14  '  ' x $!indent;15}1617method suite-loading(Str :$file) { }1819method suite-start($suite, Bool :$multi-file = False) {20  $!multi-file = $multi-file;21  if $multi-file {22    say '';23    say $suite.file.basename;24  }25}2627method group-start($group) {28  say self!prefix ~ $group.description;29  $!indent++;30}3132method group-end($group) {33  $!indent--;34}3536method group-around-skipped($group) {37  say self!prefix ~ light-blue('(group skipped: around-all did not invoke continuation)');38}3940method example-start($example, Bool :$auto = False) { }41method example-auto-description($example, Str :$description) {42  say self!prefix ~ green($description);43}4445method example-pass($example) {46  say self!prefix ~ green($example.description);47}4849method example-fail($example, :$failure-info) {50  say self!prefix ~ red($example.description ~ ' (FAILED)');51}5253method example-pending($example) {54  say self!prefix ~ light-blue($example.description ~ ' (PENDING)');55}5657method example-skipped($example) {58  say self!prefix ~ light-blue($example.description ~ ' (SKIPPED)');59}6061method example-around-skipped($example) {62  say self!prefix ~ light-blue($example.description ~ ' (SKIPPED: around-each did not invoke continuation)');63}6465method example-slow($example, Real :$threshold) { }6667method run-summary(68  $result,69  Bool :$aborted   = False,70  Int  :$fail-fast = 0,71  Str  :$order     = 'defined',72  Int  :$seed,73  Bool :$show-seed = False,74) {75  return if $!multi-file;76  callsame;77}7879method multi-file-overall(80  $result,81  Str :$order = 'defined',82  Int :$seed,83  Bool :$show-seed = False,84) {85  say '';86  Failures.say;87  callsame;88}