From: Stefano Zacchiroli Date: Fri, 29 Nov 2002 11:27:32 +0000 (+0000) Subject: use saveResultToChannel instead of gdome serialization to save test X-Git-Tag: V_0_0_6~34 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=e0889a06de3bf48cdbc33741b84901274ad83b02;p=helm.git use saveResultToChannel instead of gdome serialization to save test results --- diff --git a/helm/DEVEL/gdome_xslt/ocaml/test/test.ml b/helm/DEVEL/gdome_xslt/ocaml/test/test.ml index 3e313ed6c..4cd103435 100644 --- a/helm/DEVEL/gdome_xslt/ocaml/test/test.ml +++ b/helm/DEVEL/gdome_xslt/ocaml/test/test.ml @@ -23,16 +23,25 @@ * For more information, please send an email to *) +let (output_file, + correct_output_file, + input_file, + stylesheet_file) = + ("../../test_files/output.xml", + "../../test_files/output.xml.correct", + "../../test_files/input.xml", + "../../test_files/stylesheet.xsl") +in let domImpl = Gdome.domImplementation () in let input = - domImpl#createDocumentFromURI ~uri:"../../test_files/input.xml" () + domImpl#createDocumentFromURI ~uri:input_file () and style = - domImpl#createDocumentFromURI ~uri:"../../test_files/stylesheet.xsl" () + domImpl#createDocumentFromURI ~uri:stylesheet_file () in (* First of all, let's try the exception handling machinery *) let _ = try - ignore (Gdome_xslt.processStylesheet input) ; + ignore (Gdome_xslt.processStylesheet input); assert false (* previous line should rise an exception *) with Gdome_xslt_init.ProcessStylesheetException -> () @@ -45,16 +54,26 @@ let domImpl = Gdome.domImplementation () in "parameter3","'value3'" ] in +(* (* old version: use gdome serialization functions *) let res = - domImpl#saveDocumentToFile ~doc:output ~name:"../../test_files/output.xml" - () + domImpl#saveDocumentToFile ~doc:output ~name:output_file () in if not res then - prerr_endline "Error saving to document ../../test_files/output.xml" + prerr_endline ("Error saving to document " ^ output_file) else begin - print_endline - "The test was successful iff ../../test_files/output.xml.correct is" ; - print_endline "equal to ../../test_files/output.xml" + Printf.printf + "The test was successful iff %s is equal to %s\n" + output_file + correct_output_file end +*) + (* new version: use libxslt serialization functions *) + let outchan = open_out output_file in + Gdome_xslt.saveResultToChannel ~outchan ~result:output ~stylesheet:pstyle; + close_out outchan; + Printf.printf + "The test was successful iff %s is equal to %s\n" + output_file + correct_output_file ;;