filter date dependent lines

This commit is contained in:
Ondrej Mejzlik 2023-05-24 11:18:49 +02:00
commit 99b00a5305

View file

@ -48,12 +48,21 @@ rlJournalStart
rlGetTestState && {
rlPhaseStartTest
rlRun "enscript -f 'Times-Roman22' --header '%W Page $% of $=' -p output.ps testfile.txt" 0 "Generate ps file"
if ! rlIsFedora; then
rlRun "test $(diff example.ps output.ps | wc -l) -eq 8" 0 "Output diff has 8 lines, difference in date"
else
rlRun "test $(diff example.ps output.ps | wc -l) -eq 12" 0 "Output diff has 12 lines, difference in date"
fi
diff example.ps output.ps | sed -n 's/^> //p' > diff.txt
echo "### Meaningful differences (Filtered date dependent lines):"
sed -i '/%%CreationDate:.*/d' diff.txt
sed -i '/\/fmodstr.*/d' diff.txt
sed -i '/\/user_header_left_str.*/d' diff.txt
cat diff.txt
echo; echo "### Full diff:"
diff example.ps output.ps
if rlIsFedora; then
rlRun "test $(wc -l diff.txt | awk '{ print $1 }') -eq 1" 0 "Difference file has only one line"
rlAssertGrep '%%For: Super User' diff.txt
else
rlRun "test $(wc -l diff.txt | awk '{ print $1 }') -eq 0" 0 "Difference file has only one line"
fi
rlRun "rm -f diff.txt" 0 "Remove diff file"
rlRun "enscript -E --color --toc -w html -p output.html testfile.txt" 0 "Generate html file"
rlRun "diff example.html output.html" 0 "HTML files should not differ"
@ -68,12 +77,21 @@ rlJournalStart
diff example.ansi output.ansi
rlRun "enscript --file-align=2 -2 -B -C -G -i 1c -p - testfile.txt > output-std.ps" 0 "Generate test ps file on std"
if ! rlIsFedora; then
rlRun "test $(diff example-std.ps output-std.ps | wc -l) -eq 8" 0 "Output diff has 8 lines, difference in date"
else
rlRun "test $(diff example-std.ps output-std.ps | wc -l) -eq 12" 0 "Output diff has 12 lines, difference in date"
fi
diff example-std.ps output-std.ps | sed -n 's/^> //p' > diff.txt
echo "### Meaningful differences (Filtered date dependent lines):"
sed -i '/%%CreationDate:.*/d' diff.txt
sed -i '/\/moddatestr.*/d' diff.txt
sed -i '/\/modtimestr.*/d' diff.txt
cat diff.txt
echo; echo "### Full diff:"
diff example-std.ps output-std.ps
if rlIsFedora; then
rlRun "test $(wc -l diff.txt | awk '{ print $1 }') -eq 1" 0 "Difference file has only one line"
rlAssertGrep '%%For: Super User' diff.txt
else
rlRun "test $(wc -l diff.txt | awk '{ print $1 }') -eq 0" 0 "Difference file has only one line"
fi
rlRun "rm -f diff.txt" 0 "Remove diff file"
rlPhaseEnd
}