Codebase list libtest-mock-redis-perl / 36e1b8a
Imported Upstream version 0.07 gregor herrmann 12 years ago
5 changed file(s) with 29 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
88 Fixed Test::Exception dependency
99 0.04 Fri Feb 18
1010 Made error conditions consistent with Redis.pm's behavior
11 0.07 Wed Oct 5
12 Fix for RT-71461, incorrect rename behavior
1113
66 Test::More: 0
77 configure_requires:
88 Module::Build: 0.36
9 generated_by: 'Module::Build version 0.3607'
9 generated_by: 'Module::Build version 0.3624'
1010 license: perl
1111 meta-spec:
1212 url: http://module-build.sourceforge.net/META-spec-v1.4.html
2222 provides:
2323 Test::Mock::Redis:
2424 file: lib/Test/Mock/Redis.pm
25 version: 0.05
25 version: 0.07
2626 Test::Mock::Redis::Hash:
2727 file: lib/Test/Mock/Redis.pm
2828 Test::Mock::Redis::List:
4040 bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Mock-Redis
4141 license: http://dev.perl.org/licenses/
4242 repository: http://github.com/jlavallee/Test-Mock-Redis/
43 version: 0.05
43 version: 0.07
0 # Note: this file was auto-generated by Module::Build::Compat version 0.3607
0 # Note: this file was auto-generated by Module::Build::Compat version 0.3624
11 use ExtUtils::MakeMaker;
22 WriteMakefile
33 (
4 'NAME' => 'Test::Mock::Redis',
5 'VERSION_FROM' => 'lib/Test/Mock/Redis.pm',
6 'PREREQ_PM' => {
7 'Scalar::Util' => 0,
8 'Test::Exception' => 0,
9 'Test::More' => 0
10 },
11 'INSTALLDIRS' => 'site',
12 'EXE_FILES' => [],
13 'PL_FILES' => {}
14 )
4 'PL_FILES' => {},
5 'INSTALLDIRS' => 'site',
6 'NAME' => 'Test::Mock::Redis',
7 'EXE_FILES' => [],
8 'VERSION_FROM' => 'lib/Test/Mock/Redis.pm',
9 'PREREQ_PM' => {
10 'Test::More' => 0,
11 'Scalar::Util' => 0,
12 'Test::Exception' => 0
13 }
14 )
1515 ;
1212
1313 =head1 VERSION
1414
15 Version 0.05
15 Version 0.07
1616
1717 =cut
1818
19 our $VERSION = '0.05';
19 our $VERSION = '0.07';
2020
2121 =head1 SYNOPSIS
2222
4747
4848 It can be used in place of a Redis object for unit testing.
4949
50 If you pass the server to "connect" to, it will be ignored.
50 It accepts the "server" argument, just like Redis.pm's new.
5151
5252 =cut
5353
312312 sub keys :method {
313313 my ( $self, $match ) = @_;
314314
315 confess q{[KEYS] ERR wrong number of arguments for 'keys' command} unless defined $match;
316
315317 # TODO: we're not escaping other meta-characters
316318 $match =~ s/(?<!\\)\*/.*/g;
317319 $match =~ s/(?<!\\)\?/.?/g;
336338 confess 'rename to existing key' if $whine && $self->_stash->{$to};
337339
338340 $self->_stash->{$to} = $self->_stash->{$from};
341 delete $self->_stash->{$from};
339342 return 1;
340343 }
341344
7575
7676 is( $r->get('newfoo'), 'foobar', 'rename worked');
7777
78 is_deeply([sort $r->keys('*')], [qw/bar baz newfoo/], 'rename removed foo');
79
80
81 throws_ok { $r->keys } qr/^\Q[KEYS] ERR wrong number of arguments for 'keys' command\E/,
82 'keys with no argument complains';
83
7884 $r->set('foo', 'foobar');
7985 ok(! $r->renamenx('newfoo', 'foo'), 'renamenx returns false when destination key exists');
8086