## walk_output argument checking
-# test that walk_output accepts a HANDLE arg
-foreach my $foo (\*STDOUT, \*STDERR) {
- eval { walk_output($foo) };
- is ($@, '', "walk_output() accepts STD* " . ref $foo);
-}
-
# test that walk_output rejects non-HANDLE args
foreach my $foo (undef, 0, "string",[], {}) {
eval { walk_output($foo) };
eval { walk_output($foo) };
is ($@, '', "walk_output() accepts obj that can print");
-# now test a ref to scalar
-eval { walk_output(\my $junk) };
-is ($@, '', "walk_output() accepts ref-to-sprintf target");
-
-$junk = "non-empty";
-eval { walk_output(\$junk) };
-is ($@, '', "walk_output() accepts ref-to-non-empty-scalar");
+# test that walk_output accepts a HANDLE arg
+SKIP: {
+ skip("no perlio in this build", 4)
+ unless $Config::Config{useperlio};
+
+ foreach my $foo (\*STDOUT, \*STDERR) {
+ eval { walk_output($foo) };
+ is ($@, '', "walk_output() accepts STD* " . ref $foo);
+ }
+
+ # now test a ref to scalar
+ eval { walk_output(\my $junk) };
+ is ($@, '', "walk_output() accepts ref-to-sprintf target");
+
+ $junk = "non-empty";
+ eval { walk_output(\$junk) };
+ is ($@, '', "walk_output() accepts ref-to-non-empty-scalar");
+}
## add_style
my @stylespec;
#### for content with doc'd options
-
-set_style_standard('concise'); # MUST CALL b4 output needed
-my $func = sub{ $a = $b+42 };
-
-@options = qw(
- -basic -exec -tree -compact -loose -vt -ascii -main
- -base10 -bigendian -littleendian
- );
-foreach $opt (@options) {
- walk_output(\my $out);
- my $treegen = B::Concise::compile($opt, $func);
- $treegen->();
- #print "foo:$out\n";
- isnt($out, '', "got output with option $opt");
-}
-
-## test output control via walk_output
-
-my $treegen = B::Concise::compile('-basic', $func); # reused
-
-{ # test output into a package global string (sprintf-ish)
- our $thing;
- walk_output(\$thing);
- $treegen->();
- ok($thing, "walk_output to our SCALAR, output seen");
-}
-
+SKIP:
{ # test output to GLOB, using perlio feature directly
- skip 1, "no perlio on this build" unless $Config{useperlio};
+ skip "no perlio on this build", 18
+ unless $Config::Config{useperlio};
+
+ set_style_standard('concise'); # MUST CALL b4 output needed
+ my $func = sub{ $a = $b+42 };
+
+ @options = qw(
+ -basic -exec -tree -compact -loose -vt -ascii -main
+ -base10 -bigendian -littleendian
+ );
+ foreach $opt (@options) {
+ walk_output(\my $out);
+ my $treegen = B::Concise::compile($opt, $func);
+ $treegen->();
+ #print "foo:$out\n";
+ isnt($out, '', "got output with option $opt");
+ }
+
+ ## test output control via walk_output
+
+ my $treegen = B::Concise::compile('-basic', $func); # reused
+
+ { # test output into a package global string (sprintf-ish)
+ our $thing;
+ walk_output(\$thing);
+ $treegen->();
+ ok($thing, "walk_output to our SCALAR, output seen");
+ }
+
open (my $fh, '>', \my $buf);
walk_output($fh);
$treegen->();
ok($buf, "walk_output to GLOB, output seen");
-}
-
-## Test B::Concise::compile error checking
-
-# call compile on non-CODE ref items
-foreach my $ref ([], {}) {
- my $typ = ref $ref;
- walk_output(\my $out);
- eval { B::Concise::compile('-basic', $ref)->() };
- like ($@, qr/^err: not a coderef: $typ/,
- "compile detects $typ-ref where expecting subref");
- # is($out,'', "no output when errd"); # announcement prints
-}
-# test against a bogus autovivified subref.
-# in debugger, it should look like:
-# 1 CODE(0x84840cc)
-# -> &CODE(0x84840cc) in ???
-sub nosuchfunc;
-eval { B::Concise::compile('-basic', \&nosuchfunc)->() };
-like ($@, qr/^err: coderef has no START/,
- "compile detects CODE-ref w/o actual code");
-
-foreach my $opt (qw( -concise -exec )) {
- eval { B::Concise::compile($opt,'non_existent_function')->() };
- like ($@, qr/unknown function \(main::non_existent_function\)/,
- "'$opt' reports non-existent-function properly");
+ ## Test B::Concise::compile error checking
+
+ # call compile on non-CODE ref items
+ foreach my $ref ([], {}) {
+ my $typ = ref $ref;
+ walk_output(\my $out);
+ eval { B::Concise::compile('-basic', $ref)->() };
+ like ($@, qr/^err: not a coderef: $typ/,
+ "compile detects $typ-ref where expecting subref");
+ # is($out,'', "no output when errd"); # announcement prints
+ }
+
+
+ # test against a bogus autovivified subref.
+ # in debugger, it should look like:
+ # 1 CODE(0x84840cc)
+ # -> &CODE(0x84840cc) in ???
+ sub nosuchfunc;
+ eval { B::Concise::compile('-basic', \&nosuchfunc)->() };
+ like ($@, qr/^err: coderef has no START/,
+ "compile detects CODE-ref w/o actual code");
+
+ foreach my $opt (qw( -concise -exec )) {
+ eval { B::Concise::compile($opt,'non_existent_function')->() };
+ like ($@, qr/unknown function \(main::non_existent_function\)/,
+ "'$opt' reports non-existent-function properly");
+ }
}