aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2007-08-23 13:31:02 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2007-08-23 13:31:02 +0000
commit9bd6d59833e0e6662871f1acf6bf7c7004ee8218 (patch)
treedba0bf787c405dbef98f8f55cf19aff7d04e2f1c
parente23598049dd4d670b651f51c7df5bdee41374b2f (diff)
downloadrpm-setup-9bd6d59833e0e6662871f1acf6bf7c7004ee8218.tar
rpm-setup-9bd6d59833e0e6662871f1acf6bf7c7004ee8218.tar.gz
rpm-setup-9bd6d59833e0e6662871f1acf6bf7c7004ee8218.tar.bz2
rpm-setup-9bd6d59833e0e6662871f1acf6bf7c7004ee8218.tar.xz
rpm-setup-9bd6d59833e0e6662871f1acf6bf7c7004ee8218.zip
- add basic test runtime for find-lang
-rw-r--r--find-lang-root/usr/share/man/fr/man1/lang.1.lzmabin0 -> 18 bytes
-rw-r--r--find-lang.pl2
-rw-r--r--tests/findlang.pl34
-rwxr-xr-xtests/findlang.sh3
4 files changed, 38 insertions, 1 deletions
diff --git a/find-lang-root/usr/share/man/fr/man1/lang.1.lzma b/find-lang-root/usr/share/man/fr/man1/lang.1.lzma
new file mode 100644
index 0000000..060724c
--- /dev/null
+++ b/find-lang-root/usr/share/man/fr/man1/lang.1.lzma
Binary files differ
diff --git a/find-lang.pl b/find-lang.pl
index 52e6379..3c66e13 100644
--- a/find-lang.pl
+++ b/find-lang.pl
@@ -63,7 +63,7 @@ File::Find::find(
}
($pkg, $lang, $parent) = ($3, $2, $1);
$file =~ s/\.[^\.]+$//;
- $file .= '*';
+ $file .= '.*';
} else {
return;
}
diff --git a/tests/findlang.pl b/tests/findlang.pl
new file mode 100644
index 0000000..58dfa52
--- /dev/null
+++ b/tests/findlang.pl
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More qw(no_plan);
+
+my $pwd = `pwd`;
+chomp($pwd);
+my $testarbo = "$pwd/find-lang-root";
+
+
+my %files = (
+ # file => [ lang, is_dir ]
+ '/usr/share/man/fr' => [ 'fr', 1 ],
+ '/usr/share/man/fr/man1' => [ 'fr', 1 ],
+ '/usr/share/man/fr/man1/lang.1.*' => [ 'fr', 0 ],
+);
+
+system("/usr/bin/perl find-lang.pl $testarbo lang --with-man") and die "can't run find-lang $@";
+
+open(my $h, '<', 'lang.lang') or die "can't open lang.lang";
+
+while (my $line = <$h>) {
+ chomp($line);
+ my ($file) = $line =~ / ([^ ]+)$/;
+ my ($lang) = $line =~ /%lang\(([^\)]+)\)/;
+ $lang ||= '';
+ my $dir = $line =~ /%dir/;
+ $dir ||= 0;
+ is($lang, $files{$file}[0], "lang is find");
+ is($dir, $files{$file}[1], "%dir is properly set if need");
+}
+
diff --git a/tests/findlang.sh b/tests/findlang.sh
new file mode 100755
index 0000000..10b422c
--- /dev/null
+++ b/tests/findlang.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec perl tests/findlang.pl