1# -*- mode: perl; -*-
2
3use strict;
4use warnings;
5
6use Test::More tests => 1;
7
8###############################################################################
9# Read and load configuration file and backend library.
10
11use Config::Tiny ();
12
13my $config_file = 'xt/author/lib.ini';
14my $config = Config::Tiny -> read('xt/author/lib.ini')
15  or die Config::Tiny -> errstr();
16
17# Read the library to test.
18
19our $LIB = $config->{_}->{lib};
20
21die "No library defined in file '$config_file'"
22  unless defined $LIB;
23die "Invalid library name '$LIB' in file '$config_file'"
24  unless $LIB =~ /^[A-Za-z]\w*(::\w+)*\z/;
25
26# Read the reference type(s) the library uses.
27
28our $REF = $config->{_}->{ref};
29
30die "No reference type defined in file '$config_file'"
31  unless defined $REF;
32die "Invalid reference type '$REF' in file '$config_file'"
33  unless $REF =~ /^[A-Za-z]\w*(::\w+)*\z/;
34
35# Load the library.
36
37eval "require $LIB";
38die $@ if $@;
39
40###############################################################################
41
42pass("Configuration loaded OK");
43diag("\n\n$LIB version ", $LIB -> VERSION(), ", Perl $], $^X\n\n");
44