From fe6f1a818f07e5a3fbf94d1c3ae08bb4aa415a9e Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 14 May 2024 03:02:12 +0300 Subject: [PATCH] Compare formatted XML files in the Doxygen test. Comparing formatted XML files makes the comparison less sensitive to whitespace and newline differences between XML documents, and also makes the subsequent diff more informative, if any differences are found. --- test/doxygen/.gitignore | 1 + test/doxygen/Jamfile.v2 | 19 +++++++++++---- test/doxygen/format.xsl | 52 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 test/doxygen/format.xsl diff --git a/test/doxygen/.gitignore b/test/doxygen/.gitignore index 1936cc1..9c67cb5 100644 --- a/test/doxygen/.gitignore +++ b/test/doxygen/.gitignore @@ -1 +1,2 @@ html +autodoc.xml diff --git a/test/doxygen/Jamfile.v2 b/test/doxygen/Jamfile.v2 index d9f34f0..2c3f163 100644 --- a/test/doxygen/Jamfile.v2 +++ b/test/doxygen/Jamfile.v2 @@ -1,10 +1,12 @@ - # Copyright 2009 Daniel James. +# Copyright 2024 Andrey Semashev # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) using boostbook ; using doxygen ; +import xsltproc ; +import make ; import os ; doxygen autodoc @@ -14,13 +16,22 @@ doxygen autodoc "boost.doxygen.reftitle=Example Reference" ; +# Applies format.xsl to an XML file to reduce potential newline/whitespace +# differences and make the subsequent diff more informative. +rule format-xml ( target : source : properties * ) +{ + xsltproc.xslt $(target) : $(source) format.xsl : $(properties) ; +} + +make autodoc.xml.formatted : autodoc.xml : format-xml ; +make autodoc.gold.formatted : autodoc.gold : format-xml ; + if [ os.name ] = NT { actions compare { comp /A $(>[1]) $(>[2]) && echo "Stamped" >$(<) } - } else { @@ -30,12 +41,12 @@ else } } -make check : autodoc.xml autodoc.gold : @compare ; +make check : autodoc.xml.formatted autodoc.gold.formatted : @compare ; boostbook standalone : example.xml : - boost.root=../../../../.. + boost.root=../../../../.. autodoc ; diff --git a/test/doxygen/format.xsl b/test/doxygen/format.xsl new file mode 100644 index 0000000..6a087be --- /dev/null +++ b/test/doxygen/format.xsl @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +