Ignore:
Timestamp:
Mar 20, 2007, 4:47:05 PM (15 years ago)
Author:
Earle Martin
Message:

Complete transition to using skip_all (remove old SKIP blocks).
More verbose reporting for error "require"ing DBD::SQLite.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/t/37_search_summaries.t

    r785 r956  
    77eval { require DBD::SQLite; };
    88if ( $@ ) {
    9     plan skip_all => "DBD::SQLite not installed";
    10 } else {
    11     plan tests => 2;
     9    my ($error) = $@ =~ /^(.*?)\n/;
     10    plan skip_all => "DBD::SQLite could not be used - no database to test with ($error)";
     11}
    1212
    13     # Clear out the database from any previous runs.
    14     unlink "t/node.db";
    15     unlink <t/indexes/*>;
     13plan tests => 2;
    1614
    17     Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    18     my $config = OpenGuides::Config->new(
    19            vars => {
    20                      dbtype             => "sqlite",
    21                      dbname             => "t/node.db",
    22                      indexing_directory => "t/indexes",
    23                      script_name        => "wiki.cgi",
    24                      script_url         => "http://example.com/",
    25                      site_name          => "Test Site",
    26                      template_path      => "./templates",
    27                    }
    28     );
     15# Clear out the database from any previous runs.
     16unlink "t/node.db";
     17unlink <t/indexes/*>;
    2918
    30     # Plucene is the recommended searcher now.
    31     eval { require Wiki::Toolkit::Search::Plucene; };
    32     if ( $@ ) { $config->use_plucene( 0 ) };
     19Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     20my $config = OpenGuides::Config->new(
     21       vars => {
     22                 dbtype             => "sqlite",
     23                 dbname             => "t/node.db",
     24                 indexing_directory => "t/indexes",
     25                 script_name        => "wiki.cgi",
     26                 script_url         => "http://example.com/",
     27                 site_name          => "Test Site",
     28                 template_path      => "./templates",
     29               }
     30);
    3331
    34     my $search = OpenGuides::Search->new( config => $config );
    35     isa_ok( $search, "OpenGuides::Search" );
    36     my $wiki = $search->wiki;
    37     $wiki->write_node( "Pub Crawls", "The basic premise of the pub crawl is to visit a succession of pubs, rather than spending the entire evening or day in a single establishment. London offers an excellent choice of themes for your pub crawl.", undef, { category => "Pubs" } ) or die "Can't write node";
     32# Plucene is the recommended searcher now.
     33eval { require Wiki::Toolkit::Search::Plucene; };
     34if ( $@ ) { $config->use_plucene( 0 ) };
    3835
    39     my $output = $search->run(
    40                                return_output => 1,
    41                                vars          => { search => "pub" }
    42                              );
    43     SKIP: {
    44         skip "TODO: summaries", 1;
    45         like( $output, qr|<b>pub</b>|i,
    46               "outputs at least one bolded occurence of 'pub'" );
    47     } # end of SKIP
    48 }
     36my $search = OpenGuides::Search->new( config => $config );
     37isa_ok( $search, "OpenGuides::Search" );
     38my $wiki = $search->wiki;
     39$wiki->write_node( "Pub Crawls", "The basic premise of the pub crawl is to visit a succession of pubs, rather than spending the entire evening or day in a single establishment. London offers an excellent choice of themes for your pub crawl.", undef, { category => "Pubs" } ) or die "Can't write node";
     40
     41my $output = $search->run(
     42                           return_output => 1,
     43                           vars          => { search => "pub" }
     44                         );
     45SKIP: {
     46    skip "TODO: summaries", 1;
     47    like( $output, qr|<b>pub</b>|i,
     48          "outputs at least one bolded occurence of 'pub'" );
     49} # end of SKIP
Note: See TracChangeset for help on using the changeset viewer.