From: Matt S Trout Date: Sat, 22 Feb 2014 09:08:31 +0000 (+0000) Subject: expunge [ value => $value ] style in favour of scalarrefs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FDKit.git;a=commitdiff_plain;h=ccfe7414b0bb04396184837516ce4a0e704b1bb1 expunge [ value => $value ] style in favour of scalarrefs --- diff --git a/t/basic_rule.t b/t/basic_rule.t index 1922d7e..44e7366 100644 --- a/t/basic_rule.t +++ b/t/basic_rule.t @@ -42,7 +42,7 @@ my $solver = DX::Solver->new( ); $solver->add_rule( - server => [ 'S' ] => [ member_of => S => [ value => 'servers' ] ] + server => [ 'S' ] => [ member_of => S => \'servers' ] ); my $s = $solver->query([ server => 'S' ]); @@ -50,7 +50,7 @@ my $s = $solver->query([ server => 'S' ]); is_deeply([ map $_->value_for('S')->{name}, $s->results ], [ sort @servers ]); $solver->add_rule( - shell => [ 'S' ] => [ member_of => S => [ value => 'shells' ] ]) + shell => [ 'S' ] => [ member_of => S => \'shells' ]) ->add_rule(name => [ qw(T N) ], [ constrain => [ qw(T N) ], sub { $_[0]->{name} eq $_[1] } ] @@ -62,7 +62,7 @@ $solver->add_rule( $s = $solver->query( [ shell => 'Shell' ], - [ name => 'Shell', [ value => 'bash' ] ], + [ name => 'Shell', \'bash' ], [ server => 'Srv' ], [ shell_installed_on => qw(Shell Srv) ], ); diff --git a/t/dot_ssh.t b/t/dot_ssh.t index aac7c71..d55b5d5 100644 --- a/t/dot_ssh.t +++ b/t/dot_ssh.t @@ -93,7 +93,7 @@ is(paths_for_simple([ is_directory => 'PS' ]), '.ssh'); is(paths_for_simple([ is_file => 'PS' ]), '.ssh/authorized_keys'); -is(paths_for_simple([ mode => 'PS', [ value => '0755' ] ]), '.ssh'); +is(paths_for_simple([ mode => 'PS', \'0755' ]), '.ssh'); $solver->add_rule( path_status_at => [ 'PS', 'P' ], @@ -107,7 +107,7 @@ $solver->add_rule( throws_ok { $solver->query( - [ path_status_at => 'PS', [ value => '.ssh' ] ] + [ path_status_at => 'PS', \'.ssh' ] )->results } qr/ARGH/; @@ -128,7 +128,7 @@ my @res; lives_ok { @res = $solver->query( - [ path_status_at => 'PS', [ value => '.ssh' ] ] + [ path_status_at => 'PS', \'.ssh' ] )->results }; @@ -168,18 +168,18 @@ sub paths_for { } is( - paths_for([ path_status => 'PS' ], [ path => 'PS', [ value => '.ssh' ] ]), + paths_for([ path_status => 'PS' ], [ path => 'PS', \'.ssh' ]), '', 'no .ssh entry' ); -throws_ok { paths_for([ path_status_at => 'PS', [ value => '.ssh' ] ]) } +throws_ok { paths_for([ path_status_at => 'PS', \'.ssh' ]) } qr/refused/; $solver->{observation_policy} = sub { 1 }; is( - paths_for([ path_status_at => 'PS', [ value => '.ssh' ] ]), + paths_for([ path_status_at => 'PS', \'.ssh' ]), '.ssh', 'observation' ); @@ -188,7 +188,7 @@ is($path_status{'.ssh'}, $ob_res{'.ssh'}); delete $solver->{observation_policy}; -lives_ok { paths_for([ path_status_at => 'PS', [ value => '.ssh' ] ]) } +lives_ok { paths_for([ path_status_at => 'PS', \'.ssh' ]) } 'No observation required anymore'; $path_status{'.ssh/authorized_keys'} = $protos{'.ssh/authorized_keys'}; @@ -217,7 +217,7 @@ $ob_res{'.ssh'} = $empty{'.ssh'}; $solver->{observation_policy} = sub { 1 }; sub dot_ssh_query { - $solver->query([ directory_at => 'PS' => [ value => '.ssh' ] ]); + $solver->query([ directory_at => 'PS' => \'.ssh' ]); } is_deeply( @@ -225,7 +225,7 @@ is_deeply( [] ); -#::Dwarn(paths_for([ directory_at => 'PS', [ value => '.ssh' ] ])); +#::Dwarn(paths_for([ directory_at => 'PS', \'.ssh' ])); $solver->add_rule(@$_) for ( [ is_directory => [ qw(PS) ],