Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (25 sloc) 0.922 kB
#!perl
use strict;
use warnings;
use Test::More;
use Test::Differences;
use Test::Exception;
BEGIN {
use_ok('Elastic::Model::SearchBuilder') || print "Bail out!";
}
my $a;
ok $a = Elastic::Model::SearchBuilder->new, 'Instantiate';
ok $a = $a->new, 'Instantiate from ref';
is( scalar $a->filter(), undef, 'Empty ()' );
is( scalar $a->filter(undef), undef, '(undef)' );
is( scalar $a->filter( [] ), undef, 'Empty []' );
is( scalar $a->filter( {} ), undef, 'Empty {}' );
is( scalar $a->filter( [ [], {} ] ), undef, 'Empty [[]{}]' );
is( scalar $a->filter( { [], {} } ), undef, 'Empty {[]{}}' );
is( scalar $a->filter( { -ids => [] } ), undef, 'IDS=>[]' );
eq_or_diff $a->filter( \{ term => { foo => 1 } } ),
{ filter => { term => { foo => 1 } } },
'\\{}';
throws_ok { $a->filter( 1, 2 ) } qr/Too many params/, '1,2';
throws_ok { $a->filter( [undef] ) } qr/UNDEF in arrayref/, '[undef]';
done_testing;
Jump to Line
Something went wrong with that request. Please try again.