2 use Test::More qw(no_plan);
5 use Data::Query::Renderer::Perl;
6 use Data::Query::ExprHelpers qw(perl_scalar_value);
8 BEGIN { require 't/expr.include' }
10 my $rend = Data::Query::Renderer::Perl->new;
12 sub binding { map perl_scalar_value($_), @_ }
14 sub expr_perl_is (&;@) {
17 ? is_deeply($rend->render(_run_expr($sub)->{expr}), @_)
18 : ::Dwarn($rend->render(_run_expr($sub)->{expr}));
21 expr_perl_is { $_->foo }
23 'Simple identifier -> Perl';
25 expr_perl_is { $_->foo->group }
27 'Complex identifier -> Perl';
29 expr_perl_is { $_->foo == 1 }
30 [ "( \$_->foo == +shift )", binding(1) ],
31 "Simple expression -> Perl";
33 expr_perl_is { ($_->foo == 1) & ($_->bar eq "foo") }
35 "( ( \$_->foo == +shift ) and ( \$_->bar eq +shift ) )",
38 "Compound expression -> Perl";
40 # Skipping flattening test for now
42 expr_perl_is { !$_->foo }
44 "Unary expression ok";