Perl 6 Modules > Test-Builder-0.000.001 > Test::Builder::Output

Download:
Perl6/Test-Builder-0.000.001.tar.gz

Annotate this POD

View/Report Bugs
Source  

#= Handles output operations for Test::Builder objects class Test::Builder::Output { has $!stdout; #= Filehandle used by write() has $!stderr; #= Filehandle used by diag()

    # XXX Can I just set default attribute values and remove BUILD()?
    submethod BUILD($!stdout = $*OUT, $!stderr = $*ERR) { }

    #= Displays output to filehandle set by $.stdout
    method write(Str $msg is copy) {
        #$msg ~~ s:g/\n <!before \#>/\n \# <space>/;
        $!stdout.say($msg);
    }

    #= Displays diagnostic message to filehandle set by $.stderr
    method diag(Str $msg is copy) {
        # XXX Uncomment lines when Rakudo supports negative lookahead assertions
        #$msg ~~ s/^ <!before \#>/\# <space>/;
        #$msg ~~ s:g/\n <!before \#>/\n \# <space>/;

        $msg ~~ s/^/\x23 \x20/;
        $msg.=subst("\x0a", "\x0a\x23\x20");

        $!stderr.say($msg);
    }
}

# vim: ft=perl6

syntax highlighting: