mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
string(buffer, len) cast
This commit is contained in:
parent
92fbe56276
commit
f5c8ee4742
2 changed files with 21 additions and 2 deletions
|
@ -318,3 +318,14 @@ fn test_interpolation() {
|
|||
assert s == 'baz=baz'
|
||||
|
||||
}
|
||||
|
||||
fn test_bytes_to_string() {
|
||||
mut buf := malloc(10)
|
||||
buf[0] = `h`
|
||||
buf[1] = `e`
|
||||
buf[2] = `l`
|
||||
buf[3] = `l`
|
||||
buf[4] = `o`
|
||||
assert string(buf) == 'hello'
|
||||
assert string(buf, 2) == 'he'
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue