mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix arr.insert(0, [1,2,3])
and arr.prepend([1,2,3])
This commit is contained in:
@@ -134,6 +134,15 @@ fn test_insert() {
|
||||
assert b[0] == f64(1.1)
|
||||
}
|
||||
|
||||
fn test_insert_many() {
|
||||
mut a := [3, 4]
|
||||
a.insert(0, [1, 2])
|
||||
assert a == [1,2,3,4]
|
||||
b := [5,6]
|
||||
a.insert(1, b)
|
||||
assert a == [1,5,6,2,3,4]
|
||||
}
|
||||
|
||||
fn test_prepend() {
|
||||
mut a := []int{}
|
||||
assert a.len == 0
|
||||
@@ -147,6 +156,15 @@ fn test_prepend() {
|
||||
assert b[0] == f64(1.1)
|
||||
}
|
||||
|
||||
fn test_prepend_many() {
|
||||
mut a := [3,4]
|
||||
a.prepend([1,2])
|
||||
assert a == [1,2,3,4]
|
||||
b := [5,6]
|
||||
a.prepend(b)
|
||||
assert a == [5,6,1,2,3,4]
|
||||
}
|
||||
|
||||
fn test_strings() {
|
||||
a := ['a', 'b', 'c']
|
||||
assert a.str() == "['a', 'b', 'c']"
|
||||
@@ -166,7 +184,6 @@ fn test_compare_ints() {
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
fn test_repeat() {
|
||||
{
|
||||
a := [0].repeat(5)
|
||||
|
Reference in New Issue
Block a user