release 0.1.0
This commit is contained in:
commit
30d94536a9
90 changed files with 7722 additions and 0 deletions
67
modules/core/tests/str.owa
Normal file
67
modules/core/tests/str.owa
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
(namespace tests.str
|
||||
(test.case "str.len"
|
||||
(assert.eq! (str.len "") 0)
|
||||
(assert.eq! (str.len "hello") 5)
|
||||
)
|
||||
|
||||
(test.case "str.empty?"
|
||||
(assert.ok! (str.empty? ""))
|
||||
(assert.not! (str.empty? "a"))
|
||||
)
|
||||
|
||||
(test.case "str.is-empty?"
|
||||
(assert.ok! (str.is-empty? ""))
|
||||
(assert.not! (str.is-empty? "a"))
|
||||
)
|
||||
|
||||
(test.case "str.first"
|
||||
(assert.eq! (str.first "hello") "h")
|
||||
)
|
||||
|
||||
(test.case "str.last"
|
||||
(assert.eq! (str.last "hello") "o")
|
||||
)
|
||||
|
||||
(test.case "str.concat"
|
||||
(assert.eq! (str.concat "hello" " " "world") "hello world")
|
||||
)
|
||||
|
||||
(test.case "str.substring"
|
||||
(assert.eq! (str.substring "hello" 0 3) "hel")
|
||||
(assert.eq! (str.substring "hello" 1 4) "ell")
|
||||
)
|
||||
|
||||
(test.case "str.take"
|
||||
(assert.eq! (str.take "hello" 3) "hel")
|
||||
)
|
||||
|
||||
(test.case "str.drop"
|
||||
(assert.eq! (str.drop "hello" 2) "llo")
|
||||
)
|
||||
|
||||
(test.case "str.reverse"
|
||||
(assert.eq! (str.reverse "hello") "olleh")
|
||||
)
|
||||
|
||||
(test.case "str.starts-with?"
|
||||
(assert.ok! (str.starts-with? "hello" "hel"))
|
||||
(assert.not! (str.starts-with? "hello" "xyz"))
|
||||
)
|
||||
|
||||
(test.case "str.ends-with?"
|
||||
(assert.ok! (str.ends-with? "hello" "lo"))
|
||||
(assert.not! (str.ends-with? "hello" "xyz"))
|
||||
)
|
||||
|
||||
(test.case "str.split"
|
||||
(assert.eq! (str.split "hello world" " ") ["hello" "world"])
|
||||
(assert.eq! (str.split "hello world" "w") ["hello " "orld"])
|
||||
(assert.eq! (str.split "hello world" "x") ["hello world"])
|
||||
)
|
||||
|
||||
(test.case "str.join"
|
||||
(assert.eq! (str.join " " ["hello" "world"]) "hello world")
|
||||
(assert.eq! (str.join "w" ["hello " "orld"]) "hello world")
|
||||
(assert.eq! (str.join "x" ["hello world"]) "hello world")
|
||||
)
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue