mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
builtin: add string.trim_indent()
` method (#17099)
This commit is contained in:
parent
5aad0db0f7
commit
17d65db828
3 changed files with 244 additions and 0 deletions
|
@ -1056,3 +1056,26 @@ fn test_string_is_ascii() {
|
|||
fn test_string_with_zero_byte_escape() {
|
||||
assert '\x00'.bytes() == [u8(0)]
|
||||
}
|
||||
|
||||
fn test_is_blank() {
|
||||
assert ''.is_blank()
|
||||
assert ' '.is_blank()
|
||||
assert ' \t'.is_blank()
|
||||
assert ' \t
|
||||
|
||||
'.is_blank()
|
||||
assert ' \t\r'.is_blank()
|
||||
assert ' \t\r
|
||||
|
||||
'.is_blank()
|
||||
}
|
||||
|
||||
fn test_indent_width() {
|
||||
assert 'abc'.indent_width() == 0
|
||||
assert ' abc'.indent_width() == 1
|
||||
assert ' abc'.indent_width() == 2
|
||||
assert '\tabc'.indent_width() == 1
|
||||
assert '\t abc'.indent_width() == 2
|
||||
assert '\t\tabc'.indent_width() == 2
|
||||
assert '\t\t abc'.indent_width() == 3
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue