source: ProjectBuilder/devel/pb-modules/t/Conf.t@ 1904

Last change on this file since 1904 was 1904, checked in by Bruno Cornec, 10 years ago
  • Add a pb_conf_write function and its test
File size: 968 bytes
Line 
1#!/usr/bin/perl -w
2#
3# Tests ProjectBuilder::Base functions
4
5use strict;
6use ProjectBuilder::Base;
7use ProjectBuilder::Conf;
8
9eval
10{
11 require Test::More;
12 Test::More->import();
13 my ($tmv,$tmsv) = split(/\./,$Test::More::VERSION);
14 if ($tmsv lt 87) {
15 die "Test::More is not available in an appropriate version ($tmsv)";
16 }
17};
18
19# Test::More appropriate version not found so no test will be performed here
20if ($@) {
21 require Test;
22 Test->import();
23 plan(tests => 1);
24 print "# Faking tests as Test::More is not available in an appropriate version\n";
25 ok(1,1);
26 exit(0);
27}
28
29my $nt = 0;
30 is($path, $test->{$uri}[4], "pb_get_uri Test path $uri");
31 $nt++;
32}
33
34$ENV{'TMPDIR'} = "/tmp";
35pb_temp_init();
36
37pb_conf_init("test");
38my $cf = pb_distro_conffile();
39my $cnt = pb_get_content($cf);
40
41my %h = pb_conf_cache($cf,\%h);
42pb_conf_write("$PBTMP/test.pb",\%h);
43my $content = pb_get_content("$PBTMP/test.pb");
44is($cnt, $content, "pb_conf_write Test");
45$nt++;
46
47done_testing($nt);
Note: See TracBrowser for help on using the repository browser.