diff options
author | Simon Johansson <[email protected]> | 2019-07-04 16:17:08 +0200 |
---|---|---|
committer | Simon Johansson <[email protected]> | 2019-07-04 16:17:08 +0200 |
commit | dbcf2d350b52d42afe8694d296f8cf779f73b6c4 (patch) | |
tree | 70b32131760559f2d57689e17d9ddfc5b167dc11 /lib/eunit/src | |
parent | 7c6de1e653c45382a87e663d048d47a416fb44f8 (diff) | |
download | otp-dbcf2d350b52d42afe8694d296f8cf779f73b6c4.tar.gz otp-dbcf2d350b52d42afe8694d296f8cf779f73b6c4.tar.bz2 otp-dbcf2d350b52d42afe8694d296f8cf779f73b6c4.zip |
ERL-991 Strip control codes from eunit_surefire output
Without this, test cases which output control codes, or with names or
descriptions containing control codes, would cause the generated XML files to be
invalid.
Diffstat (limited to 'lib/eunit/src')
-rw-r--r-- | lib/eunit/src/eunit_surefire.erl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/eunit/src/eunit_surefire.erl b/lib/eunit/src/eunit_surefire.erl index 2b9f82b075..002a069a92 100644 --- a/lib/eunit/src/eunit_surefire.erl +++ b/lib/eunit/src/eunit_surefire.erl @@ -451,6 +451,11 @@ escape_xml([$< | Tail], Acc, ForAttr) -> escape_xml(Tail, [$;, $t, $l, $& | Acc] escape_xml([$> | Tail], Acc, ForAttr) -> escape_xml(Tail, [$;, $t, $g, $& | Acc], ForAttr); escape_xml([$& | Tail], Acc, ForAttr) -> escape_xml(Tail, [$;, $p, $m, $a, $& | Acc], ForAttr); escape_xml([$" | Tail], Acc, true) -> escape_xml(Tail, [$;, $t, $o, $u, $q, $& | Acc], true); % " +escape_xml([Char | Tail], Acc, ForAttr) when + Char == $\n; Char == $\r; Char == $\t -> escape_xml(Tail, [Char | Acc], ForAttr); +%% Strip C0 control codes which are not allowed in XML 1.0 +escape_xml([Char | Tail], Acc, ForAttr) when + 0 =< Char, Char =< 31 -> escape_xml(Tail, Acc, ForAttr); escape_xml([Char | Tail], Acc, ForAttr) when is_integer(Char) -> escape_xml(Tail, [Char | Acc], ForAttr). %% the input may be utf8 or latin1; the resulting list is unicode |