@@ -2,6 +2,7 @@ local t = require('luatest')
22local g = t .group ()
33
44local fun = require (' fun' )
5+ local fio = require (' fio' )
56local Runner = require (' luatest.runner' )
67local utils = require (' luatest.utils' )
78
@@ -786,6 +787,45 @@ function g.test_xml_c_data_escape()
786787 t .assert_equals (subject (" a<b]]>--" ), ' a<b]]>--' )
787788end
788789
790+ function g .test_junit_output_escape_for_attributes ()
791+ local tmpdir = fio .tempdir ()
792+ local output_path = fio .pathjoin (tmpdir , ' test_junit_escape' )
793+
794+ t .assert_equals (helper .run_suite (function (lu2 )
795+ local g_positive_start_stages = lu2 .group (' touching_positive.start.stages' , {
796+ { stage = ' COMPLETED' },
797+ { stage = ' CANCELLED' },
798+ })
799+
800+ function g_positive_start_stages .test_start () end
801+ end , {' -o' , ' junit' , ' -n' , output_path }), 0 )
802+
803+ local file = assert (io.open (output_path .. ' .xml' ))
804+ local xml = file :read (' *a' )
805+ file :close ()
806+
807+ t .assert_str_contains (
808+ xml ,
809+ ' group="touching_positive.start.stages.stage:"COMPLETED""'
810+ )
811+ t .assert_str_contains (
812+ xml ,
813+ ' name="touching_positive.start.stages.stage:"COMPLETED".test_start"'
814+ )
815+
816+ t .assert_str_contains (
817+ xml ,
818+ ' group="touching_positive.start.stages.stage:"CANCELLED""'
819+ )
820+ t .assert_str_contains (
821+ xml ,
822+ ' name="touching_positive.start.stages.stage:"CANCELLED".test_start"'
823+ )
824+
825+ fio .rmtree (tmpdir )
826+ end
827+
828+
789829function g .test_stripStackTrace ()
790830 local subject = utils .strip_luatest_trace
791831
0 commit comments