bluebird75 / luaunit

LuaUnit is a popular unit-testing framework for Lua, with an interface typical of xUnit libraries (Python unittest, Junit, NUnit, ...). It supports several output formats (Text, TAP, JUnit, ...) to be used directly or work with Continuous Integration platforms (Jenkins, Maven, ...).
Other
572 stars 137 forks source link

JUnit output doesn't escape class or test names #125

Closed tommaisey closed 4 years ago

tommaisey commented 4 years ago

Easy fix:

self.fd:write(string.format(' <testcase classname="%s" name="%s" time="%0.3f">\n', node.className, node.testName, node.duration ) ) becomes self.fd:write(string.format(' <testcase classname="%s" name="%s" time="%0.3f">\n', xmlEscape(node.className), xmlEscape(node.testName), node.duration ) )

bluebird75 commented 4 years ago

Let me try to guess : you are using non latin1 characters in your class names ? If that's the case, indeed, this new feature of lua 3.4 was not anticipated ....

tommaisey commented 4 years ago

Just an occasional & or < here and there :)

bluebird75 commented 4 years ago

How do you put such strange characters inside the class or method name ? They are not allowed inside a lua identifier.

bluebird75 commented 4 years ago

I can not reproduce it.