move tests to testament (#16101)

* move tests to testament

* minor

* fix random

* disable test random
This commit is contained in:
flywind 2020-11-25 02:06:41 +08:00 • committed by GitHub
commit cbc793b30b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 2205 additions and 2232 deletions

View file

@ -0,0 +1,22 @@
import strmisc
doAssert expandTabs("\t", 4) == " "
doAssert expandTabs("\tfoo\t", 4) == " foo "
doAssert expandTabs("\tfoo\tbar", 4) == " foo bar"
doAssert expandTabs("\tfoo\tbar\t", 4) == " foo bar "
doAssert expandTabs("", 4) == ""
doAssert expandTabs("", 0) == ""
doAssert expandTabs("\t\t\t", 0) == ""
doAssert partition("foo:bar", ":") == ("foo", ":", "bar")
doAssert partition("foobarbar", "bar") == ("foo", "bar", "bar")
doAssert partition("foobarbar", "bank") == ("foobarbar", "", "")
doAssert partition("foobarbar", "foo") == ("", "foo", "barbar")
doAssert partition("foofoobar", "bar") == ("foofoo", "bar", "")
doAssert rpartition("foo:bar", ":") == ("foo", ":", "bar")
doAssert rpartition("foobarbar", "bar") == ("foobar", "bar", "")
doAssert rpartition("foobarbar", "bank") == ("", "", "foobarbar")
doAssert rpartition("foobarbar", "foo") == ("", "foo", "barbar")
doAssert rpartition("foofoobar", "bar") == ("foofoo", "bar", "")