[Bps-public-commit] Prophet branch, master, updated. 0.69_01-36-g87d6961
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu Sep 3 03:11:18 EDT 2009
The branch, master has been updated
via 87d69617621d731d69c846bc5ed96ffbcc655a55 (commit)
from 6c6e306d4afa708a0c411e4d01f2127cb698c3ba (commit)
Summary of changes:
t/aliases_with_quotes.t | 76 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 76 insertions(+), 0 deletions(-)
create mode 100644 t/aliases_with_quotes.t
- Log -----------------------------------------------------------------
commit 87d69617621d731d69c846bc5ed96ffbcc655a55
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Sep 3 15:11:12 2009 +0800
add aliases test with quotes
diff --git a/t/aliases_with_quotes.t b/t/aliases_with_quotes.t
new file mode 100644
index 0000000..4f5c818
--- /dev/null
+++ b/t/aliases_with_quotes.t
@@ -0,0 +1,76 @@
+#!/usr/bin/perl -w
+#
+use warnings;
+use strict;
+use Prophet::Test tests => 18;
+
+as_alice {
+ run_command('init');
+ my ( $output, $error ) =
+ run_command( qw/create --type Bug --/, 'summary=foo bar' );
+ my $bug_id;
+ like(
+ $output,
+ qr/Created Bug \d+ \((\S+)\)(?{ $bug_id = $1 })/,
+ "created bug"
+ );
+ use_ok('Prophet::CLI');
+ my $a = Prophet::CLI->new();
+ can_ok( $a, 'app_handle' );
+ can_ok( $a->app_handle, 'config' );
+ my $config = $a->config;
+ $config->load;
+
+ is_deeply( scalar $config->aliases, {}, 'initial alias is empty' );
+
+ # no news is good news
+ my @cmds = (
+ {
+ cmd => ['show'],
+ output => qr/No aliases for the current repository/,
+ comment => 'show empty aliases',
+ },
+ {
+ cmd => [ 'add', 'unbalanced = one"double' ],
+ comment => 'add a new alias',
+
+ # no output specified = no output expected
+ },
+ {
+ cmd => ['unbalanced'],
+ output => qr/one"double/,
+ comment => 'new alias set correctly',
+ },
+ {
+
+ # this alias is bad, please don't use it in real life
+ cmd => [ 'add', 'balanced_1=search --type Bug -- summary="foo bar"' ],
+ comment => 'add a new alias',
+ },
+ {
+
+ # this alias is bad, please don't use it in real life
+ cmd => [ 'add', 'balanced_2=search --type Bug -- summary "foo bar"' ],
+ comment => 'add a new alias',
+ },
+ );
+
+ for my $item (@cmds) {
+ my $exp_output = defined $item->{output} ? $item->{output} : qr/^$/;
+ my $exp_error = defined $item->{error} ? $item->{error} : qr/^$/;
+
+ my ( $got_output, $got_error ) =
+ run_command( 'aliases', @{ $item->{cmd} } );
+
+ like( $got_output, $exp_output, $item->{comment} . ' (STDOUT)' );
+ like( $got_error, $exp_error, $item->{comment} . ' (STDERR)' );
+ }
+
+ ( $output, $error ) = run_command('unbalanced');
+ like( $error, qr/unbalanced quote/, 'unbalanced quote got error' );
+ ($output, $error) = run_command(qw/search --type Bug -- summary/, 'foo bar' );
+ ($output) = run_command('balanced_1');
+ like( $output, qr/$bug_id/, 'quote in aliase like --summary="foo bar"' );
+ ($output) = run_command('balanced_2');
+ like( $output, qr/$bug_id/, 'quote in aliase like --summary "foo bar"' );
+};
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list