1use strict;
2use Test::More tests => 7;
3use HTTP::Proxy;
4
5my $proxy;
6
7$proxy = HTTP::Proxy->new;
8is_deeply( $proxy->stash, {}, "Empty stash by default" );
9
10$proxy = HTTP::Proxy->new( stash => { clunk => 'slosh', plop => 'biff' } );
11is( $proxy->stash('clunk'), 'slosh', "get clunk from stash" );
12is( $proxy->stash('plop'),  'biff',  "get plop from stash" );
13is_deeply(
14    $proxy->stash,
15    { clunk => 'slosh', plop => 'biff' },
16    "the whole hash"
17);
18
19is( $proxy->stash( clunk => 'sock' ), 'sock', "set returns the new value" );
20is( $proxy->stash('clunk'), 'sock', "the new value is set" );
21
22my $h = $proxy->stash;
23%$h = ( thwack => 'spla_a_t', rip => 'uggh', zowie => 'thwape' );
24is_deeply(
25    $proxy->stash,
26    { thwack => 'spla_a_t', rip => 'uggh', zowie => 'thwape' },
27    "stash() is a reference to the stash itself"
28);
29