Last change
on this file since 1904 was 1904, checked in by Bruno Cornec, 9 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 |
|
---|
5 | use strict;
|
---|
6 | use ProjectBuilder::Base;
|
---|
7 | use ProjectBuilder::Conf;
|
---|
8 |
|
---|
9 | eval
|
---|
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
|
---|
20 | if ($@) {
|
---|
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 |
|
---|
29 | my $nt = 0;
|
---|
30 | is($path, $test->{$uri}[4], "pb_get_uri Test path $uri");
|
---|
31 | $nt++;
|
---|
32 | }
|
---|
33 |
|
---|
34 | $ENV{'TMPDIR'} = "/tmp";
|
---|
35 | pb_temp_init();
|
---|
36 |
|
---|
37 | pb_conf_init("test");
|
---|
38 | my $cf = pb_distro_conffile();
|
---|
39 | my $cnt = pb_get_content($cf);
|
---|
40 |
|
---|
41 | my %h = pb_conf_cache($cf,\%h);
|
---|
42 | pb_conf_write("$PBTMP/test.pb",\%h);
|
---|
43 | my $content = pb_get_content("$PBTMP/test.pb");
|
---|
44 | is($cnt, $content, "pb_conf_write Test");
|
---|
45 | $nt++;
|
---|
46 |
|
---|
47 | done_testing($nt);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.