File: 16stash.t

package info (click to toggle)
libhttp-proxy-perl 0.301-1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 636 kB
  • ctags: 164
  • sloc: perl: 2,403; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 828 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use strict;
use Test::More tests => 7;
use HTTP::Proxy;

my $proxy;

$proxy = HTTP::Proxy->new;
is_deeply( $proxy->stash, {}, "Empty stash by default" );

$proxy = HTTP::Proxy->new( stash => { clunk => 'slosh', plop => 'biff' } );
is( $proxy->stash('clunk'), 'slosh', "get clunk from stash" );
is( $proxy->stash('plop'),  'biff',  "get plop from stash" );
is_deeply(
    $proxy->stash,
    { clunk => 'slosh', plop => 'biff' },
    "the whole hash"
);

is( $proxy->stash( clunk => 'sock' ), 'sock', "set returns the new value" );
is( $proxy->stash('clunk'), 'sock', "the new value is set" );

my $h = $proxy->stash;
%$h = ( thwack => 'spla_a_t', rip => 'uggh', zowie => 'thwape' );
is_deeply(
    $proxy->stash,
    { thwack => 'spla_a_t', rip => 'uggh', zowie => 'thwape' },
    "stash() is a reference to the stash itself"
);