1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: add charptr str() and change string format (#12973)

This commit is contained in:
yuyi
2021-12-31 04:34:24 +08:00
committed by GitHub
parent b10ff1e41b
commit a0a1807e2b
5 changed files with 26 additions and 20 deletions

View File

@ -29,12 +29,14 @@ fn test_str_methods() {
assert u32(-1).str() == '4294967295'
assert u64(1).str() == '1'
assert u64(-1).str() == '18446744073709551615'
assert voidptr(-1).str() == 'ffffffffffffffff'
assert voidptr(1).str() == '1'
assert voidptr(-1).str() == '0xffffffffffffffff'
assert voidptr(1).str() == '0x1'
assert (&byte(-1)).str() == 'ffffffffffffffff'
assert (&byte(1)).str() == '1'
assert byteptr(-1).str() == 'ffffffffffffffff'
assert byteptr(1).str() == '1'
assert byteptr(-1).str() == '0xffffffffffffffff'
assert byteptr(1).str() == '0x1'
assert charptr(-1).str() == '0xffffffffffffffff'
assert charptr(1).str() == '0x1'
}
fn test_and_precendence() {