1
2use strict;
3use warnings;
4
5use Test::More tests => 9;
6BEGIN { require "t/utils.pl" };
7
8use_ok 'Parse::BooleanLogic';
9
10my $parser = Parse::BooleanLogic->new( parens => [qw({ })] );
11
12parse_cmp
13    $parser,
14    '',
15    [],
16;
17
18parse_cmp
19    $parser,
20    'x = 10',
21    [{ operand => 'x = 10' }],
22;
23
24parse_cmp
25    $parser,
26    '(x = 10)',
27    [{ operand => '(x = 10)' }],
28;
29parse_cmp
30    $parser,
31    '{x = 10}',
32    [[{ operand => 'x = 10' }]],
33;
34
35parse_cmp
36    $parser,
37    '{x = 10} OR y = "Y"',
38    [
39        [{ operand => 'x = 10' }],
40        'OR',
41        { operand => 'y = "Y"' }
42    ],
43;
44
45parse_cmp
46    $parser,
47    'just a string',
48    [{ operand => 'just a string' }],
49;
50
51parse_cmp
52    $parser,
53    '"quoted string {with parens}"',
54    [{ operand => '"quoted string {with parens}"' }],
55;
56
57parse_cmp
58    $parser,
59    'string OR string',
60    [{ operand => 'string' }, 'OR', { operand => 'string' }],
61;
62
63