From 0883115a02c01051f29057593bd5b37271899e75 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 27 Jan 2023 15:59:52 -0300 Subject: [PATCH] Bug 32741: Regression tests Signed-off-by: Tomas Cohen Arazi --- xt/verify_bib1.att.t | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 xt/verify_bib1.att.t diff --git a/xt/verify_bib1.att.t b/xt/verify_bib1.att.t new file mode 100755 index 00000000000..aca317670dc --- /dev/null +++ b/xt/verify_bib1.att.t @@ -0,0 +1,47 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; + +use Test::More tests => 2; + +foreach my $record_type ( qw( biblios authorities ) ) { + + subtest "bib1.att tests for $record_type" => sub { + + my $bib1_att = "etc/zebradb/$record_type/etc/bib1.att"; + + my $att_codes = {}; + + open my $fh, '<', $bib1_att or die "Cannot open file $bib1_att: $!\n"; + + while (<$fh>) { + + chomp; + + if ( $_ =~ m/^att\s(?\d+)/ ) { + $att_codes->{ $+{code} }++; + } + } + + foreach my $code (keys %{$att_codes}) { + is( $att_codes->{$code}, 1, "Only one occurrence for code ($code)" ); + } + }; +} + +1; -- 2.34.1