2 # Before 'make install' is performed this script should be runnable with
3 # 'make test'. After 'make install' it should work as 'perl test.pl'
5 #########################
7 # change 'tests => 1' to 'tests => last_test_to_print';
11 BEGIN {$SIG{__WARN__} = sub { die "Terminating test due to warning: $_[0]" } };
15 BEGIN { plan tests => 4 };
16 use Xapian qw(:standard);
17 ok(1); # If we made it this far, we're ok.
19 #########################
21 # Insert your test code below, the Test module is use()ed here so read
22 # its man page ( perldoc Test ) for help writing this test script.
24 # first create database dir, if it doesn't exist;
25 my $db_dir = 'testdb-exception';
27 if( (! -e $db_dir) or (! -d $db_dir) ) {
31 opendir( DB_DIR, $db_dir );
32 while( defined( my $file = readdir( DB_DIR ) ) ) {
33 next if $file =~ /^\.+$/;
34 unlink( "$db_dir/$file" ) or die "Could not delete '$db_dir/$file': $!";
39 ok( $database = Xapian::WritableDatabase->new( $db_dir, Xapian::DB_CREATE ) );
42 my $other_database = Xapian::Database->new( $db_dir );
46 # should fail because database is already locked
47 my $other_database = Xapian::WritableDatabase->new( $db_dir, Xapian::DB_CREATE );