Last change
on this file since 2324 was 1905, checked in by Bruno Cornec, 10 years ago |
- pb_conf_write is indeed working and tested now (git error)
|
File size:
1.3 KB
|
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 | use ProjectBuilder::Distribution;
|
---|
9 |
|
---|
10 | eval
|
---|
11 | {
|
---|
12 | require Test::More;
|
---|
13 | Test::More->import();
|
---|
14 | my ($tmv,$tmsv) = split(/\./,$Test::More::VERSION);
|
---|
15 | if ($tmsv lt 87) {
|
---|
16 | die "Test::More is not available in an appropriate version ($tmsv)";
|
---|
17 | }
|
---|
18 | };
|
---|
19 |
|
---|
20 | # Test::More appropriate version not found so no test will be performed here
|
---|
21 | if ($@) {
|
---|
22 | require Test;
|
---|
23 | Test->import();
|
---|
24 | plan(tests => 1);
|
---|
25 | print "# Faking tests as Test::More is not available in an appropriate version\n";
|
---|
26 | ok(1,1);
|
---|
27 | exit(0);
|
---|
28 | }
|
---|
29 |
|
---|
30 | my $nt = 0;
|
---|
31 |
|
---|
32 | $ENV{'TMPDIR'} = "/tmp";
|
---|
33 | pb_temp_init();
|
---|
34 |
|
---|
35 | pb_conf_init("test");
|
---|
36 | open(FILE,"> $ENV{'TMPDIR'}/conf.pb") || die "Unable to create $ENV{'TMPDIR'}/conf.pb";
|
---|
37 | # should be in alphabetic order
|
---|
38 | print FILE "truc mageia-4-x86_64 = la tete a toto\n";
|
---|
39 | print FILE "yorro mageia-3-x86_64 = tartampion\n";
|
---|
40 | print FILE "zz mageia-3-x86_64 = yy\n";
|
---|
41 | close(FILE);
|
---|
42 | my $cnt = pb_get_content("$ENV{'TMPDIR'}/conf.pb");
|
---|
43 |
|
---|
44 | my %h;
|
---|
45 | my $h = \%h;
|
---|
46 | $h = pb_conf_cache("$ENV{'TMPDIR'}/conf.pb",$h);
|
---|
47 | pb_conf_write("$ENV{'TMPDIR'}/test.pb",$h);
|
---|
48 | my $content = pb_get_content("$ENV{'TMPDIR'}/test.pb");
|
---|
49 | is($cnt, $content, "pb_conf_write Test");
|
---|
50 | $nt++;
|
---|
51 | unlink("$ENV{'TMPDIR'}/conf.pb");
|
---|
52 | unlink("$ENV{'TMPDIR'}/test.pb");
|
---|
53 |
|
---|
54 | done_testing($nt);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.