mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 22:45:51 +01:00
Add testcase example.
This commit is contained in:
21
src/test/scala/util/StringUtilSpec.scala
Normal file
21
src/test/scala/util/StringUtilSpec.scala
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package util
|
||||||
|
|
||||||
|
import org.specs2.mutable._
|
||||||
|
|
||||||
|
class StringUtilSpec extends Specification {
|
||||||
|
|
||||||
|
"urlDecode" should {
|
||||||
|
"decode encoded string to original string" in {
|
||||||
|
val encoded = StringUtil.urlEncode("あいうえお")
|
||||||
|
StringUtil.urlDecode(encoded) mustEqual "あいうえお"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"splitWords" should {
|
||||||
|
"split string by whitespaces" in {
|
||||||
|
val split = StringUtil.splitWords("aa bb\tcc dd \t ee")
|
||||||
|
split mustEqual Array("aa", "bb", "cc", "dd", "ee")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user