let strings = import "std/strings.ucg"; let t = import "std/testing.ucg"; let str_class = strings.wrap("foo bar"); assert t.equal{ left = str_class.split_on{}, right = ["foo", "bar"], }; assert t.equal{ left = strings.wrap("foo").split_on{}, right = ["foo"], }; assert t.equal{ left = strings.wrap("").split_on{}, right = [""], }; assert t.equal{ left = strings.wrap("foo=>bar=>quux").split_on{on="=>"}, right = ["foo", "bar", "quux"], }; assert t.equal{ left = str_class.split_at(3), right = {left="foo", right=" bar"}, }; assert t.equal{ left = str_class.len, right = 7, }; assert t.equal{ left = str_class.chars, right = ["f", "o", "o", " ", "b", "a", "r"], }; assert t.equal{ left = str_class.substr{start=1}.str, right = "oo bar", }; assert t.equal{ left = str_class.substr{end=5}.str, right = "foo ba", }; assert t.equal{ left = str_class.substr{end=8}.str, right = "foo bar", }; assert t.equal{ left = strings.wrap("123").parse_int().unwrap(), right = 123, }; let str_int = strings.wrap("123"); assert t.equal{ left = strings.wrap("123 ").parse_int().unwrap(), right = 123, };