Created
December 11, 2015 21:55
-
-
Save alien11689/521c346d741057467393 to your computer and use it in GitHub Desktop.
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
fun String.isPhoneNumber() = matches(Regex("\\d{11}")) |
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
import spock.lang.Specification | |
class MyScriptSpec extends Specification { | |
def 'shoould check is string a phone number'() { | |
expect: | |
// '48123123123'.isPhoneNumber() // it does not work | |
MyScriptKt.isPhoneNumber("48123123123") | |
!MyScriptKt.isPhoneNumber("") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment