source: trunk/t/12_macros.t @ 361

Last change on this file since 361 was 361, checked in by kake, 18 years ago

Test overhaul - no longer require database access info.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1018 bytes
Line 
1use strict;
2use Config::Tiny;
3use OpenGuides::Utils;
4use Test::More tests => 2;
5
6eval { require DBD::SQLite; };
7my $have_sqlite = $@ ? 0 : 1;
8
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;
26
27\@INDEX_LINK [[Category Foo]]
28
29\@INDEX_LINK [[Category Bar|Bars]]
30
31WIKI
32
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}
Note: See TracBrowser for help on using the repository browser.