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/52_display_diffs.t

    r949 r956  
    77eval { require DBD::SQLite; };
    88
    9 if ($@) {
    10     plan skip_all => "DBD::SQLite not installed - no database to test with";
    11 } else {
    12     plan tests => 5;
     9if ( $@ ) {
     10    my ($error) = $@ =~ /^(.*?)\n/;
     11    plan skip_all => "DBD::SQLite could not be used - no database to test with ($error)";
    1312}
    1413
     14plan tests => 5;
    1515
    16 SKIP: {
    17     Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    18     my $config = OpenGuides::Test->make_basic_config;
    19     my $guide = OpenGuides->new( config => $config );
    20     my $wiki = $guide->wiki;
     16Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     17my $config = OpenGuides::Test->make_basic_config;
     18my $guide = OpenGuides->new( config => $config );
     19my $wiki = $guide->wiki;
    2120
    22     # Clear out the database from any previous runs.
    23     foreach my $del_node ( $wiki->list_all_nodes ) {
    24         print "# Deleting node $del_node\n";
    25         $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    26     }
     21# Clear out the database from any previous runs.
     22foreach my $del_node ( $wiki->list_all_nodes ) {
     23    print "# Deleting node $del_node\n";
     24    $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
     25}
    2726
    28     $wiki->write_node( "I Like Pie", "Best pie is meat pie." )
    29       or die "Couldn't write node";
    30     my %data = $wiki->retrieve_node( "I Like Pie" );
    31     $wiki->write_node( "I Like Pie", "Best pie is apple pie.",
    32                        $data{checksum} )
    33       or die "Couldn't write node";
    34     %data = $wiki->retrieve_node( "I Like Pie" );
    35     $wiki->write_node( "I Like Pie", "Best pie is lentil pie.",
    36                        $data{checksum} )
    37       or die "Couldn't write node";
     27$wiki->write_node( "I Like Pie", "Best pie is meat pie." )
     28  or die "Couldn't write node";
     29my %data = $wiki->retrieve_node( "I Like Pie" );
     30$wiki->write_node( "I Like Pie", "Best pie is apple pie.",
     31                   $data{checksum} )
     32  or die "Couldn't write node";
     33%data = $wiki->retrieve_node( "I Like Pie" );
     34$wiki->write_node( "I Like Pie", "Best pie is lentil pie.",
     35                   $data{checksum} )
     36  or die "Couldn't write node";
    3837
    39     my $output = eval {
    40         $guide->display_diffs(
    41                                id            => "I Like Pie",
    42                                version       => 3,
    43                                other_version => 2,
    44                                return_output => 1,
    45                              );
    46     };
    47     is( $@, "", "->display_diffs doesn't die" );
    48     like( $output,
    49           qr/differences between version 2 and version 3/i,
    50           "...version numbers included in output" );
    51     like( $output, qr|<span class="node_name">I Like Pie</span>|,
    52           "...node name inlined in output" );
    53     unlike( $output, qr/contents are identical/i,
    54             "...'contents are identical' not printed when contents differ" );
    55     like( $output, qr/<th.*Version\s+2.*Version\s+3.*apple.*lentil/s,
    56           "...versions are right way round" );
    57 }
     38my $output = eval {
     39    $guide->display_diffs(
     40                           id            => "I Like Pie",
     41                           version       => 3,
     42                           other_version => 2,
     43                           return_output => 1,
     44                         );
     45};
     46is( $@, "", "->display_diffs doesn't die" );
     47like( $output,
     48      qr/differences between version 2 and version 3/i,
     49      "...version numbers included in output" );
     50like( $output, qr|<span class="node_name">I Like Pie</span>|,
     51      "...node name inlined in output" );
     52unlike( $output, qr/contents are identical/i,
     53        "...'contents are identical' not printed when contents differ" );
     54like( $output, qr/<th.*Version\s+2.*Version\s+3.*apple.*lentil/s,
     55      "...versions are right way round" );
Note: See TracChangeset for help on using the changeset viewer.