Improve test suite for inability to use KorAP-Tokenizer
Change-Id: I6580bf0f4937d4955e0f520c318171b4b059743b
diff --git a/Changes b/Changes
index e8f2bef..47e620d 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
2.3.2 2022-03-23
- Do not reference metadata.xml
- Remove schema references from header files.
+ - Improve test suite for unability to use
+ KorAP-Tokenizer.
2.3.1 2022-01-14 Release
- Improve script handling of broken data
diff --git a/lib/KorAP/XML/TEI/Tokenizer/KorAP.pm b/lib/KorAP/XML/TEI/Tokenizer/KorAP.pm
index acc30af..b3c09d7 100644
--- a/lib/KorAP/XML/TEI/Tokenizer/KorAP.pm
+++ b/lib/KorAP/XML/TEI/Tokenizer/KorAP.pm
@@ -17,12 +17,16 @@
return 0;
};
-
my $tokenizer_jar = dist_file(
'tei2korapxml',
'KorAP-Tokenizer-2.2.2-standalone.jar'
);
+unless (-f $tokenizer_jar) {
+ return 0;
+};
+
+no warnings 'redefine';
# Construct a new KorAP Tokenizer
sub new {
diff --git a/t/tokenization-korap.t b/t/tokenization-korap.t
index d852b4e..ae21638 100644
--- a/t/tokenization-korap.t
+++ b/t/tokenization-korap.t
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 33;
+use Test::More;
use File::Basename 'dirname';
use File::Spec::Functions qw/catfile/;
use Test::XML::Loy;
@@ -15,7 +15,7 @@
} or do {
plan skip_all => "KorAP::XML::TEI::Tokenizer::KorAP cannot be used";
};
-}
+};
use_ok('KorAP::XML::TEI::Annotations::Collector');
require_ok('KorAP::XML::TEI::Tokenizer::KorAP');