Permalink
Browse files

better test case

  • Loading branch information...
1 parent f1351b5 commit 49bbf149ba54f6671b059f86d5795e704f177e9c @tokuhirom committed Nov 30, 2010
Showing with 17 additions and 12 deletions.
  1. +17 −12 t/01_simple.t
View
@@ -8,18 +8,23 @@ my $memcached_bin = File::Which::which('memcached');
plan skip_all => "This test requires memcached binary" unless $memcached_bin;
my $port = Test::TCP::empty_port();
-my $proc = proc_guard($memcached_bin, '-p', $port);
-ok $proc->pid, 'memcached: ' . $proc->pid;
-Test::TCP::wait_port($port);
+my $pid;
+{
+ my $proc = proc_guard($memcached_bin, '-p', $port);
+ $pid = $proc->pid;
+ ok $proc->pid, 'memcached: ' . $proc->pid;
+ Test::TCP::wait_port($port);
-my $sock = IO::Socket::INET->new(
- PeerAddr => '127.0.0.1',
- PeerPort => $port,
- Proto => 'tcp',
-) or die $!;
-print $sock "version\r\n";
-my $version = <$sock>;
-like $version, qr/VERSION \d\.\d\.\d/;
-note $version;
+ my $sock = IO::Socket::INET->new(
+ PeerAddr => '127.0.0.1',
+ PeerPort => $port,
+ Proto => 'tcp',
+ ) or die $!;
+ print $sock "version\r\n";
+ my $version = <$sock>;
+ like $version, qr/VERSION \d\.\d\.\d/;
+ note $version;
+}
+is scalar(kill($pid)), 0, 'already killed';
done_testing;

0 comments on commit 49bbf14

Please sign in to comment.