- my @switches = ();
- if ($self->{switches}) {
- push @switches, $self->{switches};
- }
- if ($self->{lib}) {
- foreach (@{$self->{lib}}) {
- my $l = $_;
-
- # It seems that $switches is getting interpreted with 'eval' or
- # something like that, and that we need to take care of backslashes
- # or they will disappear along the way.
- $l =~ s|\\|\\\\|g if $^O eq "MSWin32";
- push @switches, "-I$l";
- }
+ my $failure_verbosity = $openssl_args{failure_verbosity};
+ if ($failure_verbosity == 3) {
+ push @failure_output, $self->as_string;
+ } elsif ($failure_verbosity > 0) {
+ my $is_plan = $self->is_plan;
+ my $tests_planned = $is_plan && $self->tests_planned;
+ my $is_test = $self->is_test;
+ my $is_ok = $is_test && $self->is_ok;
+ # workaround in case parser not coping with indentation:
+ if ($self->is_unknown) {
+ ($is_plan, $tests_planned) = (1, $1)
+ if ($self->as_string =~ m/^\s+1\.\.(\d+)/);
+ ($is_test, $is_ok) = (1, !$1)
+ if ($self->as_string =~ m/^\s+(not )?ok /);
+ }
+ if ($is_plan) {
+ push @plans, $tests_planned;
+ $output_buffer = ""; # ignore comments etc. until plan
+ } elsif ($is_test) { # result of a test
+ pop @plans if @plans && --($plans[-1]) <= 0;
+ print $output_buffer if !$is_ok;
+ print $self->as_string."\n"
+ if !$is_ok || $failure_verbosity == 2;
+ $output_buffer = "";
+ } else { # typically comment or unknown
+ $output_buffer .= $self->as_string."\n";
+ }
+ }
+ }
+ }
+
+ if ($failure_verbosity > 0) {
+ $callbacks{EOF} = sub {
+ my $self = shift;
+
+ # We know we are a TAP::Parser::Aggregator object
+ if (scalar $self->failed > 0 && @failure_output) {
+ # We add an extra empty line, because in the case of a
+ # progress counter, we're still at the end of that progress
+ # line.
+ print $_, "\n" foreach (("", @failure_output));
+ }
+ # Echo any trailing comments etc.
+ print "$output_buffer" if $failure_verbosity != 3;
+ };
+ }
+
+ if (keys %callbacks) {
+ # If %opts already has a callbacks element, the order here
+ # ensures we do not override it
+ %opts = ( callbacks => { %callbacks }, %opts );
+ }
+
+ return $class->SUPER::new({ %opts });