-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1dc9b4b
commit c2afbe5
Showing
4 changed files
with
62 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
booster-kotlinx/src/test/kotlin/com/didiglobal/booster/kotlinx/TextTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.didiglobal.booster.kotlinx | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertFalse | ||
import kotlin.test.assertTrue | ||
|
||
/** | ||
* Unit test for String extension | ||
* | ||
* @author johnsonlee | ||
*/ | ||
class TextTest { | ||
|
||
@Test | ||
fun `test java identifier validation`() { | ||
assertFalse("".isValidJavaIdentifier()) | ||
assertFalse("1".isValidJavaIdentifier()) | ||
assertFalse(".".isValidJavaIdentifier()) | ||
assertTrue("_".isValidJavaIdentifier()) | ||
assertTrue("$".isValidJavaIdentifier()) | ||
assertFalse("1a".isValidJavaIdentifier()) | ||
assertFalse(".a".isValidJavaIdentifier()) | ||
assertTrue("_a".isValidJavaIdentifier()) | ||
assertTrue("\$a".isValidJavaIdentifier()) | ||
assertTrue("ab".isValidJavaIdentifier()) | ||
assertTrue("ab1".isValidJavaIdentifier()) | ||
assertTrue("ab$".isValidJavaIdentifier()) | ||
assertTrue("ab_".isValidJavaIdentifier()) | ||
assertFalse("ab.".isValidJavaIdentifier()) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters