mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: add charptr.vstring() and charptr.vstring_with_len() (#6830)
This commit is contained in:
@ -528,6 +528,14 @@ fn test_bytes_to_string() {
|
||||
assert bytes.bytestr() == 'hello'
|
||||
}
|
||||
|
||||
fn test_charptr() {
|
||||
foo := charptr('VLANG'.str)
|
||||
println(typeof(foo))
|
||||
assert typeof(foo) == 'charptr'
|
||||
assert unsafe { foo.vstring() } == 'VLANG'
|
||||
assert unsafe { foo.vstring_with_len(3) } == 'VLA'
|
||||
}
|
||||
|
||||
fn test_count() {
|
||||
assert ''.count('') == 0
|
||||
assert ''.count('a') == 0
|
||||
|
Reference in New Issue
Block a user