X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fbasic.t;h=1ea8e7e84a170f47e1041c9a7e2ef1a268da2253;hb=26dcff5be6f9c5ef869a539d43ed364f4c7177a3;hp=a356a94d298e192d62e2784958520ed5cc847642;hpb=4d098922f606b8b4cd6da92745cf5e5c39d478d6;p=catagits%2FCatalyst-Plugin-Cache.git diff --git a/t/basic.t b/t/basic.t index a356a94..1ea8e7e 100644 --- a/t/basic.t +++ b/t/basic.t @@ -93,3 +93,12 @@ my $cache_norm = $c->cache(); is( $cache_norm->get("foo"), undef, "default curried cache has no foo"); is( $cache_elk->get("foo"), "gorch", "curried custom backend has foo" ); + + +is( $c->cache->get('compute_test'), undef, 'compute_test key is undef by default' ); +is( $c->cache->compute('compute_test',sub{'monkey'}), 'monkey', 'compute returned code value' ); +is( $c->cache->get('compute_test'), 'monkey', 'compute_test key is now set' ); +is( $c->cache->compute('compute_test',sub{'donkey'}), 'monkey', 'compute returned cached value' ); +$c->cache->remove('compute_test'); +is( $c->cache->compute('compute_test',sub{'donkey'}), 'donkey', 'compute returned second code value' ); +