[K/N] Migrate runtime to new case conversion api
This commit is contained in:
@@ -174,7 +174,7 @@ internal class TestRunner(val suites: List<TestSuite>, args: Array<String>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setLoggerFromArg(logger: String) {
|
private fun setLoggerFromArg(logger: String) {
|
||||||
when (logger.toUpperCase()) {
|
when (logger.uppercase()) {
|
||||||
"GTEST" -> this.logger = GTestLogger()
|
"GTEST" -> this.logger = GTestLogger()
|
||||||
"TEAMCITY" -> this.logger = TeamCityLogger()
|
"TEAMCITY" -> this.logger = TeamCityLogger()
|
||||||
"SIMPLE" -> this.logger = SimpleTestLogger()
|
"SIMPLE" -> this.logger = SimpleTestLogger()
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ internal actual fun checkRadix(radix: Int): Int {
|
|||||||
internal fun Char.Companion.toLowerCase(codePoint: Int): Int =
|
internal fun Char.Companion.toLowerCase(codePoint: Int): Int =
|
||||||
if (codePoint < MIN_SUPPLEMENTARY_CODE_POINT) {
|
if (codePoint < MIN_SUPPLEMENTARY_CODE_POINT) {
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
codePoint.toChar().toLowerCase().toInt()
|
codePoint.toChar().lowercaseChar().toInt()
|
||||||
} else {
|
} else {
|
||||||
codePoint // TODO: Implement this transformation for supplementary codepoints.
|
codePoint // TODO: Implement this transformation for supplementary codepoints.
|
||||||
}
|
}
|
||||||
@@ -278,7 +278,7 @@ internal fun Char.Companion.toLowerCase(codePoint: Int): Int =
|
|||||||
internal fun Char.Companion.toUpperCase(codePoint: Int): Int =
|
internal fun Char.Companion.toUpperCase(codePoint: Int): Int =
|
||||||
if (codePoint < MIN_SUPPLEMENTARY_CODE_POINT) {
|
if (codePoint < MIN_SUPPLEMENTARY_CODE_POINT) {
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
codePoint.toChar().toUpperCase().toInt()
|
codePoint.toChar().uppercaseChar().toInt()
|
||||||
} else {
|
} else {
|
||||||
codePoint // TODO: Implement this transformation for supplementary codepoints.
|
codePoint // TODO: Implement this transformation for supplementary codepoints.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -256,6 +256,7 @@ private external fun toCharArray(string: String, start: Int, size: Int): CharArr
|
|||||||
@Deprecated("Use replaceFirstChar instead.", ReplaceWith("replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }"))
|
@Deprecated("Use replaceFirstChar instead.", ReplaceWith("replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }"))
|
||||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||||
public actual fun String.capitalize(): String {
|
public actual fun String.capitalize(): String {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
return if (isNotEmpty() && this[0].isLowerCase()) substring(0, 1).toUpperCase() + substring(1) else this
|
return if (isNotEmpty() && this[0].isLowerCase()) substring(0, 1).toUpperCase() + substring(1) else this
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,6 +269,7 @@ public actual fun String.capitalize(): String {
|
|||||||
@Deprecated("Use replaceFirstChar instead.", ReplaceWith("replaceFirstChar { it.lowercase() }"))
|
@Deprecated("Use replaceFirstChar instead.", ReplaceWith("replaceFirstChar { it.lowercase() }"))
|
||||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||||
public actual fun String.decapitalize(): String {
|
public actual fun String.decapitalize(): String {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
return if (isNotEmpty() && !this[0].isLowerCase()) substring(0, 1).toLowerCase() + substring(1) else this
|
return if (isNotEmpty() && !this[0].isLowerCase()) substring(0, 1).toLowerCase() + substring(1) else this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ package kotlin.text.regex
|
|||||||
open internal class CharSet(char: Char, val ignoreCase: Boolean = false) : LeafSet() {
|
open internal class CharSet(char: Char, val ignoreCase: Boolean = false) : LeafSet() {
|
||||||
|
|
||||||
// We use only low case characters when working in case insensitive mode.
|
// We use only low case characters when working in case insensitive mode.
|
||||||
val char: Char = if (ignoreCase) char.toLowerCase() else char
|
val char: Char = if (ignoreCase) char.lowercaseChar() else char
|
||||||
|
|
||||||
// Overrides =======================================================================================================
|
// Overrides =======================================================================================================
|
||||||
|
|
||||||
override fun accepts(startIndex: Int, testString: CharSequence): Int {
|
override fun accepts(startIndex: Int, testString: CharSequence): Int {
|
||||||
if (ignoreCase) {
|
if (ignoreCase) {
|
||||||
return if (this.char == testString[startIndex].toLowerCase()) 1 else -1
|
return if (this.char == testString[startIndex].lowercaseChar()) 1 else -1
|
||||||
} else {
|
} else {
|
||||||
return if (this.char == testString[startIndex]) 1 else -1
|
return if (this.char == testString[startIndex]) 1 else -1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ open internal class RangeSet(charClass: AbstractCharClass, val ignoreCase: Boole
|
|||||||
override fun accepts(startIndex: Int, testString: CharSequence): Int {
|
override fun accepts(startIndex: Int, testString: CharSequence): Int {
|
||||||
if (ignoreCase) {
|
if (ignoreCase) {
|
||||||
val char = testString[startIndex]
|
val char = testString[startIndex]
|
||||||
return if (chars.contains(char.toUpperCase()) || chars.contains(char.toLowerCase())) 1 else -1
|
return if (chars.contains(char.uppercaseChar()) || chars.contains(char.lowercaseChar())) 1 else -1
|
||||||
} else {
|
} else {
|
||||||
return if (chars.contains(testString[startIndex])) 1 else -1
|
return if (chars.contains(testString[startIndex])) 1 else -1
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -122,7 +122,7 @@ open internal class SupplementaryRangeSet(charClass: AbstractCharClass, val igno
|
|||||||
|
|
||||||
fun contains(char: Char): Boolean {
|
fun contains(char: Char): Boolean {
|
||||||
if (ignoreCase) {
|
if (ignoreCase) {
|
||||||
return chars.contains(char.toUpperCase()) || chars.contains(char.toLowerCase())
|
return chars.contains(char.uppercaseChar()) || chars.contains(char.lowercaseChar())
|
||||||
} else {
|
} else {
|
||||||
return chars.contains(char)
|
return chars.contains(char)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user