You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2024/06/12 13:38:09 UTC
(avro) branch main updated: AVRO-3999 - Avoid warnings in Perl test suite (#2953)
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/main by this push:
new 072b51fb5 AVRO-3999 - Avoid warnings in Perl test suite (#2953)
072b51fb5 is described below
commit 072b51fb548c35fee192917ef1d3cdbd944ef53b
Author: José Joaquín Atria <jj...@gmail.com>
AuthorDate: Wed Jun 12 14:38:04 2024 +0100
AVRO-3999 - Avoid warnings in Perl test suite (#2953)
* Add error message when schema do not match in Perl
When the schema did not match in a call to Avro::BinaryDecoder::decode,
a Avro::Schema::Error::Mismatch error was thrown without a body. This
was generating a warning when trying to stringify an undefined value,
and resulted in the empty string being used as the error message, which
was not veryb informative.
This change adds a message which should solve both issues.
* Do not exit sub via next in Perl tests
This silences a loud warning in xt/schema.t
---
lang/perl/lib/Avro/BinaryDecoder.pm | 2 +-
lang/perl/xt/schema.t | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lang/perl/lib/Avro/BinaryDecoder.pm b/lang/perl/lib/Avro/BinaryDecoder.pm
index fa12fcf07..557322790 100644
--- a/lang/perl/lib/Avro/BinaryDecoder.pm
+++ b/lang/perl/lib/Avro/BinaryDecoder.pm
@@ -67,7 +67,7 @@ sub decode {
my $type = Avro::Schema->match(
writer => $writer_schema,
reader => $reader_schema,
- ) or throw Avro::Schema::Error::Mismatch;
+ ) or throw Avro::Schema::Error::Mismatch 'schema do not match';
my $meth = "decode_$type";
return $class->$meth($writer_schema, $reader_schema, $reader);
diff --git a/lang/perl/xt/schema.t b/lang/perl/xt/schema.t
index 5225ce455..06792b28d 100644
--- a/lang/perl/xt/schema.t
+++ b/lang/perl/xt/schema.t
@@ -23,7 +23,7 @@ use File::Find;
use_ok 'Avro::Schema';
sub parse {
- next unless /\.avsc$/;
+ return unless /\.avsc$/;
open(my $fh, '<', $_);
local $/ = undef;
my $schema = <$fh>;