← Back to index

lib/BDD/Behave/Formatter/Progress.rakumod

37 / 37 lines covered (100.0%)

1use BDD::Behave::Colors;2use BDD::Behave::Failures;3use BDD::Behave::Formatter;4use BDD::Behave::Formatter::Tree;56unit class BDD::Behave::Formatter::Progress is BDD::Behave::Formatter::Tree;78has Bool $!multi-file = False;9has Int  $!total      = 0;10has Int  $!shown      = 0;1112method name(--> Str) { 'progress' }1314method set-total(Int $total) {15  $!total = $total;16}1718method !maybe-print-total {19  return unless $!total > 0;20  $!shown++;21  print " ({$!shown}/{$!total})\n";22}2324method suite-loading(Str :$file) { }2526method suite-start($suite, Bool :$multi-file = False) {27  $!multi-file = $multi-file;28}2930method group-start($group) { }31method group-end($group)   { }32method group-around-skipped($group) {33  print light-blue('S');34}3536method example-start($example, Bool :$auto = False) { }37method example-auto-description($example, Str :$description) { }3839method example-pass($example) {40  print green('.');41  self!maybe-print-total;42}4344method example-fail($example, :$failure-info) {45  print red('F');46  self!maybe-print-total;47}4849method example-pending($example) {50  print light-blue('*');51  self!maybe-print-total;52}5354method example-skipped($example) {55  print light-blue('S');56  self!maybe-print-total;57}5859method example-around-skipped($example) {60  print light-blue('S');61  self!maybe-print-total;62}6364method example-retry($example, Int :$attempt, Int :$max-attempts) {65  print yellow('R');66}6768method example-slow($example, Real :$threshold) { }6970method run-summary(71  $result,72  Bool :$aborted   = False,73  Int  :$fail-fast = 0,74  Str  :$order     = 'defined',75  Int  :$seed,76  Bool :$show-seed = False,77) {78  return if $!multi-file;79  callsame;80}8182method multi-file-overall(83  $result,84  Str :$order = 'defined',85  Int :$seed,86  Bool :$show-seed = False,87) {88  say '';89  Failures.say;90  callsame;91}