Moved tests
that are used both for codegen & diagnostics to codegen/box/diagnostics
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
fun escapeChar(c : Char) : String? = when (c) {
|
||||
'\\' -> "\\\\"
|
||||
'\n' -> "\\n"
|
||||
'"' -> "\\\""
|
||||
else -> "" + c
|
||||
}
|
||||
|
||||
tailRecursive fun String.escape(i : Int = 0, result : StringBuilder = StringBuilder()) : String =
|
||||
if (i == length) result.toString()
|
||||
else escape(i + 1, result.append(escapeChar(get(i))))
|
||||
|
||||
fun box() : String {
|
||||
"test me not \\".escape()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user