mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
array: replace make() with the new init syntax
This commit is contained in:
@ -26,18 +26,6 @@ fn __new_array(mylen int, cap int, elm_size int) array {
|
||||
return arr
|
||||
}
|
||||
|
||||
// TODO
|
||||
pub fn make(len int, cap int, elm_size int) array {
|
||||
return __new_array(len, cap, elm_size)
|
||||
}
|
||||
|
||||
/*
|
||||
struct Foo {
|
||||
a []string
|
||||
b [][]string
|
||||
}
|
||||
*/
|
||||
|
||||
// Private function, used by V (`nums := [1, 2, 3]`)
|
||||
fn new_array_from_c_array(len, cap, elm_size int, c_array voidptr) array {
|
||||
cap_ := if cap == 0 { 1 } else { cap }
|
||||
|
@ -551,6 +551,7 @@ fn test_array_str() {
|
||||
numbers := [1, 2, 3]
|
||||
assert numbers == [1,2,3]
|
||||
numbers2 := [numbers, [4, 5, 6]] // dup str() bug
|
||||
_=numbers2
|
||||
assert true
|
||||
assert numbers.str() == '[1, 2, 3]'
|
||||
// QTODO
|
||||
@ -727,4 +728,7 @@ fn test_array_with_cap() {
|
||||
a4 := []int{cap:10, len:1 }
|
||||
assert a4.len == 1
|
||||
assert a4.cap == 10
|
||||
a5 := []int{len:1, cap:10}
|
||||
assert a5.len == 1
|
||||
assert a5.cap == 10
|
||||
}
|
||||
|
Reference in New Issue
Block a user