Changeset 23875 for branches/neb_distrib_20081210/Nebulous/t
- Timestamp:
- Apr 15, 2009, 11:32:16 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/neb_distrib_20081210/Nebulous/t/70_neb-ls.t
r23867 r23875 2 2 3 3 # Copyright (C) 2009 Joshua Hoblitt 4 5 use strict;6 use warnings;7 8 use lib qw( ./lib ./t );9 10 use Test::Cmd;11 use Test::More tests => 3;12 4 13 5 =head1 NAME … … 21 13 =cut 22 14 15 use strict; 16 use warnings; 17 18 use Apache::Test qw( -withtestmore ); 19 plan tests => 31; 20 21 use lib qw( ./lib ./t ); 22 23 use Test::Cmd; 24 use Nebulous::Client; 25 use Test::Nebulous; 26 27 my $hostport = Apache::Test->config->{ 'hostport' }; 28 my $neb_url = "http://$hostport/nebulous"; 29 30 23 31 my $cmd = 'bin/neb-ls'; 24 32 … … 26 34 chmod 0755, 'bin/neb-ls'; 27 35 28 29 36 my $test = Test::Cmd->new(prog => $cmd, workdir => ''); 30 37 isa_ok($test, 'Test::Cmd'); 31 38 39 # NEB_SERVER env var not set 40 Test::Nebulous->setup; 41 32 42 { 33 43 $test->run(args => ''); 34 44 missing_args(2, "Required options: --server"); 35 45 } 46 47 # NEB_SERVER set 48 Test::Nebulous->setup; 49 50 { 51 $ENV{NEB_SERVER} = $neb_url; 52 53 $test->run(args => ''); 54 is($? >> 8, 0, "exit code"); 55 } 56 57 Test::Nebulous->setup; 58 59 { 60 my $neb = Nebulous::Client->new( 61 proxy => $neb_url, 62 ); 63 $neb->create('foo'); 64 65 $test->run(args => ''); 66 67 is($? >> 8, 0, "exit code"); 68 like($test->stdout, qr/^foo$/, "stdout"); 69 like($test->stderr, qr/^$/, "stderr"); 70 } 71 72 Test::Nebulous->setup; 73 74 { 75 my $neb = Nebulous::Client->new( 76 proxy => $neb_url, 77 ); 78 $neb->create('foo'); 79 $neb->create('bar'); 80 81 $test->run(args => ''); 82 83 is($? >> 8, 0, "exit code"); 84 like($test->stdout, qr/^foo bar$/, "stdout"); 85 like($test->stderr, qr/^$/, "stderr"); 86 } 87 88 Test::Nebulous->setup; 89 90 { 91 my $neb = Nebulous::Client->new( 92 proxy => $neb_url, 93 ); 94 $neb->create('foo'); 95 $neb->create('bar'); 96 97 $test->run(args => '-l'); 98 99 is($? >> 8, 0, "exit code"); 100 like($test->stdout, qr/^foo\nbar\n$/, "stdout"); 101 like($test->stderr, qr/^$/, "stderr"); 102 } 103 104 Test::Nebulous->setup; 105 106 { 107 my $neb = Nebulous::Client->new( 108 proxy => $neb_url, 109 ); 110 $neb->create('foo'); 111 $neb->create('bar'); 112 113 $test->run(args => '-1'); 114 115 is($? >> 8, 0, "exit code"); 116 like($test->stdout, qr/^foo\nbar\n$/, "stdout"); 117 like($test->stderr, qr/^$/, "stderr"); 118 } 119 120 Test::Nebulous->setup; 121 122 { 123 my $neb = Nebulous::Client->new( 124 proxy => $neb_url, 125 ); 126 $neb->create('a/foo'); 127 128 $test->run(args => ''); 129 130 is($? >> 8, 0, "exit code"); 131 like($test->stdout, qr||, "stdout"); 132 like($test->stderr, qr/^$/, "stderr"); 133 } 134 135 Test::Nebulous->setup; 136 137 { 138 my $neb = Nebulous::Client->new( 139 proxy => $neb_url, 140 ); 141 $neb->create('a/foo'); 142 143 $test->run(args => 'a'); 144 145 is($? >> 8, 0, "exit code"); 146 like($test->stdout, qr|^a/foo$|, "stdout"); 147 like($test->stderr, qr/^$/, "stderr"); 148 } 149 150 Test::Nebulous->setup; 151 152 { 153 my $neb = Nebulous::Client->new( 154 proxy => $neb_url, 155 ); 156 $neb->create('a/foo'); 157 $neb->create('a/bar'); 158 159 $test->run(args => 'a'); 160 161 is($? >> 8, 0, "exit code"); 162 like($test->stdout, qr|^a/foo a/bar$|, "stdout"); 163 like($test->stderr, qr/^$/, "stderr"); 164 } 165 166 Test::Nebulous->setup; 167 168 { 169 my $neb = Nebulous::Client->new( 170 proxy => $neb_url, 171 ); 172 $neb->create('a/foo'); 173 $neb->create('foo'); 174 175 $test->run(args => 'a'); 176 177 is($? >> 8, 0, "exit code"); 178 like($test->stdout, qr|^a/foo$|, "stdout"); 179 like($test->stderr, qr/^$/, "stderr"); 180 } 181 182 Test::Nebulous->setup; 183 184 { 185 my $neb = Nebulous::Client->new( 186 proxy => $neb_url, 187 ); 188 $neb->create('a/foo'); 189 $neb->create('a/b/foo'); 190 191 $test->run(args => 'a'); 192 193 is($? >> 8, 0, "exit code"); 194 like($test->stdout, qr|^a/foo$|, "stdout"); 195 like($test->stderr, qr/^$/, "stderr"); 196 } 197 198 Test::Nebulous->cleanup; 36 199 37 200 sub missing_args
Note:
See TracChangeset
for help on using the changeset viewer.
