mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-11-01 04:56:13 +00:00
stylize_as_junit.rb: XML escape test name
If you had a TEST_CASE which contained a quoted string as a parameter then the xml generated would be invalid.
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
# =========================================================================
|
# =========================================================================
|
||||||
|
|
||||||
|
require 'cgi'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
require 'ostruct'
|
require 'ostruct'
|
||||||
@@ -143,6 +144,7 @@ class UnityToJUnit
|
|||||||
lines.each do |line|
|
lines.each do |line|
|
||||||
line = line.tr('\\', '/')
|
line = line.tr('\\', '/')
|
||||||
_src_file, src_line, test_name, status, msg = line.split(/:/)
|
_src_file, src_line, test_name, status, msg = line.split(/:/)
|
||||||
|
test_name = CGI.escapeHTML(test_name.to_s)
|
||||||
case status
|
case status
|
||||||
when 'IGNORE' then results[:ignores] << { test: test_name, line: src_line, message: msg }
|
when 'IGNORE' then results[:ignores] << { test: test_name, line: src_line, message: msg }
|
||||||
when 'FAIL' then results[:failures] << { test: test_name, line: src_line, message: msg }
|
when 'FAIL' then results[:failures] << { test: test_name, line: src_line, message: msg }
|
||||||
|
|||||||
Reference in New Issue
Block a user