[Bps-public-commit] r9632 - Parse-BooleanLogic/t

ruz at bestpractical.com ruz at bestpractical.com
Fri Nov 9 18:32:43 EST 2007


Author: ruz
Date: Fri Nov  9 18:32:43 2007
New Revision: 9632

Added:
   Parse-BooleanLogic/t/
   Parse-BooleanLogic/t/basics.t
   Parse-BooleanLogic/t/load.t

Log:
* tests

Added: Parse-BooleanLogic/t/basics.t
==============================================================================
--- (empty file)
+++ Parse-BooleanLogic/t/basics.t	Fri Nov  9 18:32:43 2007
@@ -0,0 +1,70 @@
+
+use strict;
+use warnings;
+
+use Test::More tests => 11;
+use Test::Deep;
+
+use_ok 'Parse::BooleanLogic';
+
+
+my $parser = new Parse::BooleanLogic;
+
+sub parse_cmp($$) {
+    my ($string, $struct) = @_;
+    cmp_deeply $parser->as_array($string), $struct, $string;
+}
+
+parse_cmp
+    '',
+    [],
+;
+
+parse_cmp
+    'x = 10',
+    [{ operand => 'x = 10' }],
+;
+
+parse_cmp
+    '(x = 10)',
+    [[{ operand => 'x = 10' }]],
+;
+
+parse_cmp
+    '(x = 10) OR y = "Y"',
+    [
+        [{ operand => 'x = 10' }],
+        'OR',
+        { operand => 'y = "Y"' }
+    ],
+;
+
+parse_cmp
+    'just a string',
+    [{ operand => 'just a string' }],
+;
+
+parse_cmp
+    '"quoted string"',
+    [{ operand => '"quoted string"' }],
+;
+
+parse_cmp
+    '"quoted string (with parens)"',
+    [{ operand => '"quoted string (with parens)"' }],
+;
+
+parse_cmp
+    'string "quoted" in the middle',
+    [{ operand => 'string "quoted" in the middle' }],
+;
+
+parse_cmp
+    'string OR string',
+    [{ operand => 'string' }, 'OR', { operand => 'string' }],
+;
+
+parse_cmp
+    '"OR" OR string',
+    [{ operand => '"OR"' }, 'OR', { operand => 'string' }],
+;

Added: Parse-BooleanLogic/t/load.t
==============================================================================
--- (empty file)
+++ Parse-BooleanLogic/t/load.t	Fri Nov  9 18:32:43 2007
@@ -0,0 +1,7 @@
+
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+use_ok 'Parse::BooleanLogic';
+



More information about the Bps-public-commit mailing list