Skip to content

Commit

Permalink
dev-perl/WordNet-QueryData: EAPI6 + Tests
Browse files Browse the repository at this point in the history
- EAPI6ify
- Actually make it work at runtime with paths
- Fix tests to not be madness against different wordnet datasets
- Fix tests to be TAP::Harness friendly
- Enable tests

Package-Manager: Portage-2.3.24, Repoman-2.3.6
  • Loading branch information
kentfredric committed Mar 21, 2018
1 parent 4de4850 commit 51e88d0
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 0 deletions.
22 changes: 22 additions & 0 deletions dev-perl/WordNet-QueryData/WordNet-QueryData-1.490.0-r2.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

DIST_AUTHOR=JRENNIE
DIST_VERSION=1.49
inherit perl-module

DESCRIPTION="Direct perl interface to WordNet database"

SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

DEPEND="app-dicts/wordnet"
RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}/${PN}-1.49-paths.patch"
"${FILESDIR}/${PN}-1.49-test-counts.patch"
"${FILESDIR}/${PN}-1.49-harness.patch"
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From a29056d2dca8cfb27750e391a95dd2f612a02a87 Mon Sep 17 00:00:00 2001
From: Kent Fredric <[email protected]>
Date: Wed, 21 Mar 2018 22:28:11 +1300
Subject: Reorganize into proper test structure to make harness work

---
MANIFEST | 2 +-
test.pl => t/wnqd.t | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename test.pl => t/wnqd.t (100%)

diff --git a/MANIFEST b/MANIFEST
index 6b05bf0..3c8aeaa 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,7 +1,7 @@
ChangeLog
Makefile.PL
README
-test.pl
+t/wnqd.t
QueryData.pm
MANIFEST
META.yml Module meta-data (added by MakeMaker)
diff --git a/test.pl b/t/wnqd.t
similarity index 100%
rename from test.pl
rename to t/wnqd.t
--
2.16.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From 4efc840a9f8041c3d08de8e06d5b5386fca94e4a Mon Sep 17 00:00:00 2001
From: Kent Fredric <[email protected]>
Date: Wed, 21 Mar 2018 22:15:30 +1300
Subject: Use system wordnet path instead of usr/local

---
Makefile.PL | 2 +-
QueryData.pm | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile.PL b/Makefile.PL
index d192f6d..1932c8f 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -5,7 +5,7 @@ use ExtUtils::MakeMaker;
# $wnHomePC). These need to be synchronized. I need to import those
# variables from QueryData.pm.

-die "*** Please set the WNHOME environment variable to the location of your\n*** WordNet installation. QueryData.pm will not work otherwise.\n*** Alternatively, you can make the installation in the default\n*** location, C:\\Program Files\\WordNet\\3.0 on Windows, or /usr/local/WordNet-3.0 on unix.\n" unless exists $ENV{WNHOME} or exists $ENV{WNSEARCHDIR} or -d "C:\\Program Files\\WordNet\\3.0" or -d "/usr/local/WordNet-3.0";
+die "*** Please set the WNHOME environment variable to the location of your\n*** WordNet installation. QueryData.pm will not work otherwise.\n*** Alternatively, you can make the installation in the default\n*** location, C:\\Program Files\\WordNet\\3.0 on Windows, or /usr/share/wordnet on unix.\n" unless exists $ENV{WNHOME} or exists $ENV{WNSEARCHDIR} or -d "C:\\Program Files\\WordNet\\3.0" or -d "/usr/share/wordnet";

WriteMakefile(
'dist' => { 'COMPRESS' => 'gzip', 'SUFFIX' => '.gz', },
diff --git a/QueryData.pm b/QueryData.pm
index ee27ee6..fc6168a 100644
--- a/QueryData.pm
+++ b/QueryData.pm
@@ -201,7 +201,7 @@ my @excFile = ("", "noun.exc", "verb.exc", "adj.exc", "adv.exc");
my @indexFile = ("", "index.noun", "index.verb", "index.adj", "index.adv");
my @dataFile = ("", "data.noun", "data.verb", "data.adj", "data.adv");

-my $wnHomeUnix = defined($ENV{"WNHOME"}) ? $ENV{"WNHOME"} : "/usr/local/WordNet-3.0";
+my $wnHomeUnix = defined($ENV{"WNHOME"}) ? $ENV{"WNHOME"} : "/usr/share/wordnet";
my $wnHomePC = defined($ENV{"WNHOME"}) ? $ENV{"WNHOME"} : "C:\\Program Files\\WordNet\\3.0";
my $wnPrefixUnix = defined($ENV{"WNSEARCHDIR"}) ? $ENV{"WNSEARCHDIR"} : "$wnHomeUnix/dict";
my $wnPrefixPC = defined($ENV{"WNSEARCHDIR"}) ? $ENV{"WNSEARCHDIR"} : "$wnHomePC\\dict";
@@ -1113,7 +1113,7 @@ QueryData knows about two environment variables, WNHOME and
WNSEARCHDIR. If WNSEARCHDIR is set, QueryData looks for WordNet data
files there. Otherwise, QueryData looks for WordNet data files in
WNHOME/dict (WNHOME\dict on a PC). If WNHOME is not set, it defaults
-to "/usr/local/WordNet-3.0" on Unix and "C:\Program Files\WordNet\3.0"
+to "/usr/share/wordnet" on Unix and "C:\Program Files\WordNet\3.0"
on a PC. Normally, all you have to do is to set the WNHOME variable
to the location where you unpacked your WordNet distribution. The
database files are normally unpacked to the "dict" subdirectory.
--
2.16.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From fe7f10589ee4da4a834e1f6355bb203de644920e Mon Sep 17 00:00:00 2001
From: Kent Fredric <[email protected]>
Date: Wed, 21 Mar 2018 22:24:09 +1300
Subject: Remove tests dependent on specific counts of dictionary terms

This was never going to be portable against newer wordnet data releases
---
test.pl | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/test.pl b/test.pl
index 537aa7b..386c66c 100644
--- a/test.pl
+++ b/test.pl
@@ -5,7 +5,8 @@
# $Id: test.pl,v 1.40 2007/05/07 01:08:31 jrennie Exp $

my $i = 1;
-BEGIN {
+BEGIN {
+ print "1..103\n";
$| = 1;
}
END { print "not ok 1\n" unless $loaded; }
@@ -162,14 +163,9 @@ $foo[1] == 2
? print "ok ", $i++, "\n" : print "not ok ", $i++, "\n";
($wn->querySense('acropetal#a#1', 'dmnc'))[0] eq 'botany#n#2'
? print "ok ", $i++, "\n" : print "not ok ", $i++, "\n";
-scalar $wn->offset("0#n#1") == 13742358
- ? print "ok ", $i++, "\n" : print "not ok ", $i++, "\n";

-scalar $wn->listAllWords("noun") == 117798
- ? print "ok ", $i++, "\n" : print "not ok ", $i++, "\n";
-$wn->offset("child#n#1") == 9917593
- ? print "ok ", $i++, "\n" : print "not ok ", $i++, "\n";
my ($foo) = $wn->querySense ("cat#n#1", "glos");
($foo eq "feline mammal usually having thick soft fur and no ability to roar: domestic cats; wildcats ") ? print "ok ", $i++, "\n" : print "not ok ", $i++, "\n";

}
+print "0..$i\n";
--
2.16.2

0 comments on commit 51e88d0

Please sign in to comment.