Changeset 361 for trunk/t/12_macros.t

Show
Ignore:
Timestamp:
06/07/04 21:39:35 (5 years ago)
Author:
kake
Message:

Test overhaul - no longer require database access info.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/t/12_macros.t

    r180 r361  
    44use Test::More tests => 2; 
    55 
    6 my $config = Config::Tiny->read( "wiki.conf" ) 
    7     or die "Couldn't read wiki.conf"; 
    8 my $wiki = OpenGuides::Utils->make_wiki_object( config => $config ); 
    9 my $formatter = $wiki->formatter; 
     6eval { require DBD::SQLite; }; 
     7my $have_sqlite = $@ ? 0 : 1; 
    108 
    11 my $wikitext = <<WIKI; 
     9SKIP: { 
     10    skip "DBD::SQLite not installed - no database to test with", 2 
     11      unless $have_sqlite; 
     12 
     13    my $config = Config::Tiny->new; 
     14    $config->{_} = { 
     15                     dbtype             => "sqlite", 
     16                     dbname             => "t/node.db", 
     17                     indexing_directory => "t/indexes", 
     18                     script_url         => "", 
     19                     script_name        => "", 
     20                   }; 
     21 
     22    my $wiki = OpenGuides::Utils->make_wiki_object( config => $config ); 
     23    my $formatter = $wiki->formatter; 
     24 
     25    my $wikitext = <<WIKI; 
    1226 
    1327\@INDEX_LINK [[Category Foo]] 
     
    1731WIKI 
    1832 
    19 my $html = $formatter->format($wikitext); 
    20 like( $html, qr/View all pages in Category Foo/, 
    21       "\@INDEX_LINK has right default link text" ); 
    22 like( $html, qr/>Bars<\/a>/, "...and can be overridden" ); 
     33    my $html = $formatter->format($wikitext); 
     34    like( $html, qr/View all pages in Category Foo/, 
     35          "\@INDEX_LINK has right default link text" ); 
     36    like( $html, qr/>Bars<\/a>/, "...and can be overridden" ); 
     37}