1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-24 20:06:38 +02:00

api: add function string_parse_size

This commit is contained in:
Sébastien Helleu
2022-09-25 10:53:37 +02:00
parent be6a29a596
commit 4d74a89cfc
32 changed files with 566 additions and 1 deletions
+10
View File
@@ -72,6 +72,16 @@ def test_strings():
check(weechat.string_format_size(1) == '1 byte')
check(weechat.string_format_size(2097152) == '2.10 MB')
check(weechat.string_format_size(420000000) == '420.00 MB')
check(weechat.string_parse_size('') == 0)
check(weechat.string_parse_size('*') == 0)
check(weechat.string_parse_size('z') == 0)
check(weechat.string_parse_size('1ba') == 0)
check(weechat.string_parse_size('1') == 1)
check(weechat.string_parse_size('12b') == 12)
check(weechat.string_parse_size('123 b') == 123)
check(weechat.string_parse_size('1.34k') == 1340)
check(weechat.string_parse_size('1.5m') == 1500000)
check(weechat.string_parse_size('2.1g') == 2100000000)
check(weechat.string_color_code_size('') == 0)
check(weechat.string_color_code_size('test') == 0)
str_color = weechat.color('yellow,red')