Cmake tests: Adapted BATCH tests to ignore the stored LyX-version

This commit is contained in:
Kornel Benko 2023-03-12 20:19:21 +01:00
parent 05469a053f
commit f2f49674be
3 changed files with 497 additions and 298 deletions

View File

@ -0,0 +1,45 @@
#! /usr/bin/env perl
# -*- mode: perl; -*-
# This script does a line by line comparison of two tex files. Ignore LyX-version info
use File::Slurp qw(read_file);
my $file1_name = shift;
my $file2_name = shift;
my @file1 = read_file($file1_name);
my @file2 = read_file($file2_name);
chomp @file1;
chomp @file2;
my $line_count = 0;
my @diffs;
foreach my $file1_line (@file1) {
$line_count++;
next if ($line_count == 1); # Skip the first line with the version
my $file2_line = $file2[$line_count-1];
if ($file1_line ne $file2_line) {
push @diffs, {
line => $line_count,
file1 => $file1_line,
file2 => $file2_line,
};
}
}
my $diff_output = '';
foreach $diff (@diffs) {
$diff_output .= $diff->{line} . ' - ' . $diff->{file1} . ' | ' . $diff->{file2} . "\n";
}
if ($diff_output) {
die "Differences found!\n$diff_output\n";
}
exit(0);

View File

@ -54,6 +54,8 @@ my %Tests = (
}, },
beamer_test => { beamer_test => {
src_files => ["beamer_test.lyx"], src_files => ["beamer_test.lyx"],
check_type => 'custom',
check_script => ["$perl","$test_bin/compare_exported_tex.pl"],
check => [["beamer_test.tex", "beamer_test.tex.orig"]], check => [["beamer_test.tex", "beamer_test.tex.orig"]],
commands => ["file-open beamer_test.lyx", commands => ["file-open beamer_test.lyx",
"buffer-begin", "buffer-begin",
@ -69,6 +71,8 @@ my %Tests = (
workdir => "$data", workdir => "$data",
}, },
src_files => ["vcs_info_export.lyx"], src_files => ["vcs_info_export.lyx"],
check_type => 'custom',
check_script => ["$perl","$test_bin/compare_exported_tex.pl"],
check => [["vcs_info_export.tex", "vcs_info_export.tex.orig"]], check => [["vcs_info_export.tex", "vcs_info_export.tex.orig"]],
command_line => ["-E", "pdflatex", "vcs_info_export.tex", "$data/vcs_info_export.lyx"], command_line => ["-E", "pdflatex", "vcs_info_export.tex", "$data/vcs_info_export.lyx"],
}, },