[Bps-public-commit] r12228 - in Prophet/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Sun May 11 01:13:19 EDT 2008


Author: sartak
Date: Sun May 11 01:13:19 2008
New Revision: 12228

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/Test.pm

Log:
 r55546 at onn:  sartak | 2008-05-11 01:12:09 -0400
 run_command for testing which runs the command in the same interpreter and returns its stdout


Modified: Prophet/trunk/lib/Prophet/Test.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Test.pm	(original)
+++ Prophet/trunk/lib/Prophet/Test.pm	Sun May 11 01:13:19 2008
@@ -4,7 +4,7 @@
 package Prophet::Test;
 use base qw/Test::More Exporter/;
 our @EXPORT = qw/as_alice as_bob as_charlie as_david as_user run_ok repo_uri_for run_script run_output_matches replica_last_rev replica_merge_tickets replica_uuid_for fetch_newest_changesets ok_added_revisions replica_uuid
-    serialize_conflict serialize_changeset in_gladiator diag is_script_output
+    serialize_conflict serialize_changeset in_gladiator diag is_script_output run_command
     /;
 
 use File::Path 'rmtree';
@@ -331,6 +331,24 @@
     return $cs->as_hash;
 }
 
+=head2 run_command arguments -> stdout
+
+Run the given command using a new L<Prophet::CLI> object. Returns the standard
+output of that command.
+
+Examples:
+
+    run_command('create', '--type=Foo');
+
+=cut
+
+sub run_command {
+    my $output;
+    open my $handle, '>', \$output;
+    Prophet::CLI->new->invoke($handle, @_);
+    return $output;
+}
+
 =head2 as_alice CODE, as_bob CODE, as_charlie CODE, as_david CODE
 
 Runs CODE as alice, bob, charlie or david



More information about the Bps-public-commit mailing list