core: option for control escaping of unicode characters (#103)

This commit is contained in:
Skylot
2016-03-07 19:25:57 +03:00
parent e915f4fcd7
commit 218c39b1ec
22 changed files with 237 additions and 76 deletions
@@ -1,13 +1,17 @@
package jadx.tests
import jadx.api.JadxArgs
import jadx.core.utils.StringUtils
import spock.lang.Specification
class TestStringUtils extends Specification {
def "unescape string"() {
def args = new JadxArgs()
args.setEscapeUnicode(true)
def stringUtils = new StringUtils(args)
expect:
StringUtils.unescapeString(input) == "\"$expected\""
stringUtils.unescapeString(input) == "\"$expected\""
where:
input | expected
@@ -26,12 +30,14 @@ class TestStringUtils extends Specification {
def "unescape char"() {
expect:
StringUtils.unescapeChar(input as char) == "'$expected'"
new StringUtils(new JadxArgs()).unescapeChar(input as char) == "'$expected'"
where:
input | expected
'a' | "a"
' ' | " "
'\n' | "\\n"
'\'' | "\\\'"
'\0' | "\\u0000"
}
}