[Bps-public-commit] r11391 - in SVN-PropDB: t
clkao at bestpractical.com
clkao at bestpractical.com
Wed Apr 2 06:47:25 EDT 2008
Author: clkao
Date: Wed Apr 2 06:47:24 2008
New Revision: 11391
Modified:
SVN-PropDB/lib/Prophet/Test/Arena.pm
SVN-PropDB/lib/Prophet/Test/Participant.pm
SVN-PropDB/t/create.t
Log:
fix test counts and update_record.
Modified: SVN-PropDB/lib/Prophet/Test/Arena.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Test/Arena.pm (original)
+++ SVN-PropDB/lib/Prophet/Test/Arena.pm Wed Apr 2 06:47:24 2008
@@ -30,6 +30,7 @@
local $/;
$self->run_from_data(YAML::Syck::Load( <$fh> ));
+
}
sub run_from_yamlfile {
@@ -57,7 +58,7 @@
my ($chicken) = grep { $_->name eq $name } @{ $arena->chickens };
if ($args->{record}) {
$args->{record} = $record_map->{ $args->{record} };
- }
+ }
my $next_result = $args->{result};
as_user($chicken->name, sub {
@@ -69,6 +70,12 @@
$record_map->{ $next_result } = $args->{result};
}
}
+
+# my $third = $arena->dump_state;
+# $arena->sync_all_pairs;
+# my $fourth = $arena->dump_state;
+# is_deeply($third,$fourth);
+
}
my $TB = Test::Builder->new();
Modified: SVN-PropDB/lib/Prophet/Test/Participant.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Test/Participant.pm (original)
+++ SVN-PropDB/lib/Prophet/Test/Participant.pm Wed Apr 2 06:47:24 2008
@@ -91,7 +91,7 @@
my ($ret, $out, $err) = call_func_ok( [qw(create --type Scratch), @{$args->{props}} ]);
- ok($ret, $self->name . " created a record");
+# ok($ret, $self->name . " created a record");
if ($out =~ /Created\s+(.*?)\s+(.*)$/i) {
$args->{result} = $2;
}
@@ -105,7 +105,7 @@
$args->{record} ||= get_random_local_record();
return undef unless($args->{'record'});
- my ($ok, $stdout, $stderr) = call_func_ok([qw(update --type Scratch --uuid), $args->{record}]);
+ my ($ok, $stdout, $stderr) = call_func([qw(show --type Scratch --uuid), $args->{record}]);
my %props = map { split(/: /,$_,2) } split(/\n/,$stdout);
delete $props{id};
@@ -135,7 +135,7 @@
}
sub get_random_local_record {
- my ($ok, $stdout, $stderr) = call_func_ok([qw(search --type Scratch --regex .)]);
+ my ($ok, $stdout, $stderr) = call_func([qw(search --type Scratch --regex .)]);
my $update_record = (shuffle( map { $_ =~ /^(\S*)/ } split(/\n/,$stdout)))[0];
return $update_record;
}
@@ -176,9 +176,21 @@
$self->arena->record($self->name, $action, @arg);
}
-use IO::String;
+use Test::Exception;
sub call_func_ok {
+ my @args = @_;
+ my @ret;
+ lives_and {
+ @ret = call_func(@args);
+ ok(1, join(" ", $ENV{'PROPHET_USER'}, @{$args[0]}));
+ };
+ return @ret;
+}
+
+sub call_func {
+ Carp::cluck unless ref$_[0];
+
my @args = @{ shift @_ };
my $cmd = shift @args;
local (@ARGV) = (@args);
@@ -197,7 +209,6 @@
die "I don't know how to do the $cmd";
}
select($old_fh) if defined $old_fh;
- ok(1, join(" ", $ENV{'PROPHET_USER'}, $cmd, @ARGV));
return ( $ret, $str, undef);
}
Modified: SVN-PropDB/t/create.t
==============================================================================
--- SVN-PropDB/t/create.t (original)
+++ SVN-PropDB/t/create.t Wed Apr 2 06:47:24 2008
@@ -1,6 +1,7 @@
use warnings;
use strict;
-use Test::More 'no_plan';
+use Test::More tests => 25;
+
use File::Temp qw'tempdir';
use_ok('Prophet::Handle');
More information about the Bps-public-commit
mailing list