Index: openacs-4/packages/tsearch2-driver/tcl/test/tsearch2-driver-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tsearch2-driver/tcl/test/tsearch2-driver-procs.tcl,v diff -u -N -r1.5 -r1.5.2.1 --- openacs-4/packages/tsearch2-driver/tcl/test/tsearch2-driver-procs.tcl 15 Aug 2018 16:29:24 -0000 1.5 +++ openacs-4/packages/tsearch2-driver/tcl/test/tsearch2-driver-procs.tcl 14 Mar 2019 15:23:27 -0000 1.5.2.1 @@ -7,46 +7,55 @@ @cvs-id $Id$ } -aa_register_case build_query { - build_query test -} { - aa_run_with_teardown \ - -test_code { - # some tests to see if we can turn the english query into - # something tsearch2 to_tsquery can handle +aa_register_case \ + -procs { + tsearch2::build_query + } build_query { + build_query test + } { + aa_run_with_teardown \ + -test_code { + # some tests to see if we can turn the english query into + # something tsearch2 to_tsquery can handle - set q "openacs test automated" - aa_true "Multiple terms automatic AND '[tsearch2::build_query -query $q]'" \ - [string equal "openacs & test & automated" \ - [tsearch2::build_query -query $q]] - set q "openacs test not automated" - aa_true "Multiple terms automatic AND, explicit NOT '[tsearch2::build_query -query $q]'" \ - [string equal "openacs & test & ! automated" \ - [tsearch2::build_query -query $q]] - set q "openacs test or automated" - aa_true "Multiple terms automatic AND, explicit OR '[tsearch2::build_query -query $q]'" \ - [string equal "openacs & test | automated" \ - [tsearch2::build_query -query $q]] - set q "(openacs test) or automated" - aa_true "Multiple terms grouped '[tsearch2::build_query -query $q]'" \ - [string equal "(openacs & test) | automated" \ - [tsearch2::build_query -query $q]] - set q "(openacs or test) automated" - aa_true "Multiple terms grouped automatic AND '[tsearch2::build_query -query $q]'" \ - [string equal "(openacs | test) & automated" \ - [tsearch2::build_query -query $q]] - set q "one a two" - aa_true "Single letter elements" \ - [string equal "one & a & two" \ - [tsearch2::build_query -query $q]] + set q "openacs test automated" + set query [tsearch2::build_query -query $q] + aa_true "Multiple terms automatic AND '$query'" \ + {"openacs & test & automated" eq $query} - set q "or else" - aa_true "Or at beginning by itself" \ - [string equal "else" \ - [tsearch2::build_query -query $q]] - set q "not" - aa_true "Not all alone" \ - [string equal "" \ - [tsearch2::build_query -query $q]] - } -} + set q "openacs test not automated" + set query [tsearch2::build_query -query $q] + aa_true "Multiple terms automatic AND, explicit NOT '$query'" \ + {"openacs & test & ! automated" eq $query} + + set q "openacs test or automated" + set query [tsearch2::build_query -query $q] + aa_true "Multiple terms automatic AND, explicit OR '$query'" \ + {"openacs & test | automated" eq $query} + + set q "(openacs test) or automated" + set query [tsearch2::build_query -query $q] + aa_true "Multiple terms grouped '$query'" \ + {"(openacs & test) | automated" eq $query} + + set q "(openacs or test) automated" + set query [tsearch2::build_query -query $q] + aa_true "Multiple terms grouped automatic AND '$query'" \ + {"(openacs | test) & automated" eq $query} + + set q "one a two" + set query [tsearch2::build_query -query $q] + aa_true "Single letter elements '$query'" \ + {"one & a & two" eq $query} + + set q "or else" + set query [tsearch2::build_query -query $q] + aa_true "Or at beginning by itself '$query'" \ + {"else" eq $query} + + set q "not" + set query [tsearch2::build_query -query $q] + aa_true "Not all alone '$query'" \ + {"" eq $query} + } + }