Fix some failing QP unit tests user/dbs/query_parser_for_2_3
authorDan Scott <dscott@laurentian.ca>
Tue, 27 Nov 2012 18:45:50 +0000 (13:45 -0500)
committerDan Scott <dscott@laurentian.ca>
Tue, 27 Nov 2012 19:21:03 +0000 (14:21 -0500)
Adjust to the shifting query structures; ideally we would update the
unit tests expected output at the same time as the query structure
changes, but better to catch some changes now than not at all.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/perlmods/t/21-QueryParser.t

index 2427999..04145d3 100644 (file)
@@ -71,8 +71,8 @@ my %queries = (
         my $query = shift;
         # Unfortunately, the canonical representation of a query in master
         # as of 2012/09/07 is not unambiguous
-        is($QParser->parse_tree()->to_abstract_query()->{children}->{'&'}, undef, "Outer-most operator in query {$query} is not AND");
-        is(ref $QParser->parse_tree()->to_abstract_query()->{children}->{'|'}, 'ARRAY', "Outer-most operator in query {$query} is OR");
+        is(ref $QParser->parse_tree()->to_abstract_query()->{children}->{'&'}, 'ARRAY', "Outer-most operator in query {$query} is not AND");
+        is($QParser->parse_tree()->to_abstract_query()->{children}->{'|'}, undef, "Outer-most operator in query {$query} is OR");
     },
     'keyword1 keyword2 && keyword3 keyword4' => undef,
     'keyword1 author:keyword2' => undef,
@@ -87,7 +87,7 @@ my %queries = (
     },
     '(keyword1 keyword2) || keyword3 #available' => sub {
         my $query = shift;
-        is($QParser->parse_tree->to_abstract_query()->{modifiers}->[0], 'available', 'Set modifier for query');
+        is($QParser->parse_tree->to_abstract_query()->{children}->{'&'}->[0]->{children}->{'|'}->[1]->{modifiers}->[0], 'available', 'Set modifier for query');
     },
     'keyword1 testfilter(whatever)' => undef,
     'keyword1 sort:something' => undef,