From 283101c02a7e6a71f221fe731168e9b0096e3766 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Wed, 21 May 2014 20:30:37 +0200 Subject: Added test case base template and improved transformer helper template * test case base template contains the basic test case markup ** it was mostly created to include include-path resolution into the test cases * improved transformer helper template by separating the external function call into its own variable --- CMakeLists.txt | 1 - test/check.sh | 2 +- test/common/testcase.xsl | 22 ++++++++++++++++ test/default_params/reference.xml | 2 -- test/default_params/transformation.xsl | 25 ++++++------------ test/read_directory/reference.xml | 2 -- test/read_directory/transformation.xsl | 19 ++++---------- test/read_file/reference.xml | 4 +-- test/read_file/transformation.xsl | 15 +++-------- test/read_xml_file/reference.xml | 2 -- test/read_xml_file/transformation.xsl | 19 ++++---------- test/transform/reference.xml | 2 -- test/transform/test.xsl | 2 +- test/transform/transformation.xsl | 48 ++++++++++++++++------------------ 14 files changed, 69 insertions(+), 96 deletions(-) create mode 100644 test/common/testcase.xsl diff --git a/CMakeLists.txt b/CMakeLists.txt index 7722264..e346613 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,6 @@ set( src/function/read_xml_file.cc src/function/read_directory.cc src/function/transform.cc - src/function/resolve_include.cc src/support/filesystem_context.cc src/support/stylesheet_parameter_guard.cc src/support/xalan_string.cc diff --git a/test/check.sh b/test/check.sh index fd537d7..84687bf 100755 --- a/test/check.sh +++ b/test/check.sh @@ -9,7 +9,7 @@ do cd $testcase rm -f actual.xml - ./../../build/test --transformation transformation.xsl --target actual.xml + ./../../build/test --transformation transformation.xsl --target actual.xml --include ../common/ diff -u reference.xml actual.xml if [ $? = 0 ] diff --git a/test/common/testcase.xsl b/test/common/testcase.xsl new file mode 100644 index 0000000..70bfa3a --- /dev/null +++ b/test/common/testcase.xsl @@ -0,0 +1,22 @@ + + + + + + + + + + + + diff --git a/test/default_params/reference.xml b/test/default_params/reference.xml index fcdbacf..566064b 100644 --- a/test/default_params/reference.xml +++ b/test/default_params/reference.xml @@ -1,7 +1,5 @@ - actual.xml default_params - diff --git a/test/default_params/transformation.xsl b/test/default_params/transformation.xsl index 1bbddef..0ffaea0 100644 --- a/test/default_params/transformation.xsl +++ b/test/default_params/transformation.xsl @@ -6,27 +6,18 @@ exclude-result-prefixes="InputXSLT" > - + - - - - - - - - - - - + + + + + + + diff --git a/test/read_directory/reference.xml b/test/read_directory/reference.xml index 8252569..a7192ea 100644 --- a/test/read_directory/reference.xml +++ b/test/read_directory/reference.xml @@ -1,11 +1,9 @@ - common default_params read_directory read_file read_xml_file transform - diff --git a/test/read_directory/transformation.xsl b/test/read_directory/transformation.xsl index d3c21f1..3a4d162 100644 --- a/test/read_directory/transformation.xsl +++ b/test/read_directory/transformation.xsl @@ -6,21 +6,12 @@ exclude-result-prefixes="InputXSLT" > - + - - - - - - - - + + + + diff --git a/test/read_file/reference.xml b/test/read_file/reference.xml index 7cbcc95..0bca6f7 100644 --- a/test/read_file/reference.xml +++ b/test/read_file/reference.xml @@ -1,11 +1,9 @@ - -<?xml version="1.0"?> +<?xml version="1.0"?> <tester> <eintrag>Hello 1</eintrag> <eintrag>Hello 2</eintrag> <eintrag>Hello 3</eintrag> <eintrag>Hello 4</eintrag> </tester> - diff --git a/test/read_file/transformation.xsl b/test/read_file/transformation.xsl index 96b8976..e17734e 100644 --- a/test/read_file/transformation.xsl +++ b/test/read_file/transformation.xsl @@ -6,19 +6,10 @@ exclude-result-prefixes="InputXSLT" > - + - - - - - - + + diff --git a/test/read_xml_file/reference.xml b/test/read_xml_file/reference.xml index d82dc9c..26b5f82 100644 --- a/test/read_xml_file/reference.xml +++ b/test/read_xml_file/reference.xml @@ -1,9 +1,7 @@ - Hello 1 Hello 2 Hello 3 Hello 4 - diff --git a/test/read_xml_file/transformation.xsl b/test/read_xml_file/transformation.xsl index ba6fed1..e0a3794 100644 --- a/test/read_xml_file/transformation.xsl +++ b/test/read_xml_file/transformation.xsl @@ -6,21 +6,12 @@ exclude-result-prefixes="InputXSLT" > - + - - - - - - - - + + + + diff --git a/test/transform/reference.xml b/test/transform/reference.xml index b98f978..5d45081 100644 --- a/test/transform/reference.xml +++ b/test/transform/reference.xml @@ -1,8 +1,6 @@ - 42 - diff --git a/test/transform/test.xsl b/test/transform/test.xsl index 9a1ea7a..7d4cac0 100644 --- a/test/transform/test.xsl +++ b/test/transform/test.xsl @@ -4,7 +4,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan" xmlns:InputXSLT="function.inputxslt.application" - exclude-result-prefixes="InputXSLT xalan" + exclude-result-prefixes="xalan InputXSLT" > - + - + + InputXSLT:transform( + $transformation, + $target, + xalan:nodeset($parameters) + ) + + + - - - - - test.xsl - test_actual.xml - - 21 - - + + + test.xsl + test_actual.xml + + 21 + + - - - + -- cgit v1.2.3