$|++;
-require "./test.pl";
+print "1..36\n";
+my $test = 0;
-plan(tests => 36);
+sub failed {
+ my ($got, $expected, $name) = @_;
+
+ if ($::TODO) {
+ print "not ok $test - $name # TODO: $::TODO\n";
+ }
+ else {
+ print "not ok $test - $name\n";
+ }
+ my @caller = caller(1);
+ print "# Failed test at $caller[1] line $caller[2]\n";
+ if (defined $got) {
+ print "# Got '$got'\n";
+ } else {
+ print "# Got undef\n";
+ }
+ print "# Expected $expected\n";
+ return;
+}
+
+sub like {
+ my ($got, $pattern, $name) = @_;
+ $test = $test + 1;
+ if (defined $got && $got =~ $pattern) {
+ if ($::TODO) {
+ print "ok $test - $name # TODO: $::TODO\n";
+ }
+ else {
+ print "ok $test - $name\n";
+ }
+ # Principle of least surprise - maintain the expected interface, even
+ # though we aren't using it here (yet).
+ return 1;
+ }
+ failed($got, $pattern, $name);
+}
+
+sub is {
+ my ($got, $expect, $name) = @_;
+ $test = $test + 1;
+ if (defined $got && $got eq $expect) {
+ if ($::TODO) {
+ print "ok $test - $name # TODO: $::TODO\n";
+ }
+ else {
+ print "ok $test - $name\n";
+ }
+ return 1;
+ }
+ failed($got, "'$expect'", $name);
+}
+
+sub isnt {
+ my ($got, $expect, $name) = @_;
+ $test = $test + 1;
+ if (defined $got && $got ne $expect) {
+ if ($::TODO) {
+ print "ok $test - $name # TODO: $::TODO\n";
+ }
+ else {
+ print "ok $test - $name\n";
+ }
+ return 1;
+ }
+ failed($got, "not '$expect'", $name);
+}
+
+sub can_ok {
+ my ($class, $method) = @_;
+ $test = $test + 1;
+ if (eval { $class->can($method) }) {
+ if ($::TODO) {
+ print "ok $test - $class->can('$method') # TODO: $::TODO\n";
+ }
+ else {
+ print "ok $test - $class->can('$method')\n";
+ }
+ return 1;
+ }
+ my @caller = caller;
+ print "# Failed test at $caller[1] line $caller[2]\n";
+ print "# $class cannot $method\n";
+ return;
+}
=pod
can_ok( 'main', "qx" );
eval "qx('unqualified'".
($^O eq 'MSWin32' ? " 2>&1)" : ")");
-SKIP: {
- skip("external command not portable on VMS", 1) if $^O eq 'VMS';
- TODO: {
- local $::TODO = $^O eq 'MSWin32' ? "Tainting of PATH not working of Windows" : $::TODO;
- like( $@, qr/^Insecure/, "qx('unqualified') doesn't work" );
- }
+TODO: {
+ local $::TODO = $^O eq 'MSWin32' ? "Tainting of PATH not working of Windows" : $::TODO;
+ like( $@, qr/^Insecure/, "qx('unqualified') doesn't work" );
}
is( main::qx('main'), "qx-main", "main::qx() is func" );
is( &qx('amper'), "qx-amper", "&qx() is func" );