mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
@ -428,11 +428,9 @@ fn test_multi_array_clone() {
|
||||
a3_1[0][0][1] = 0
|
||||
a3_2[0][1][0] = 0
|
||||
assert a3_1 == [[[1, 0], [2, 2], [3, 3]], [[4, 4], [5, 5],
|
||||
[6, 6],
|
||||
]]
|
||||
[6, 6]]]
|
||||
assert a3_2 == [[[1, 1], [0, 2], [3, 3]], [[4, 4], [5, 5],
|
||||
[6, 6],
|
||||
]]
|
||||
[6, 6]]]
|
||||
// 3d array_string
|
||||
mut b3_1 := [[['1', '1'], ['2', '2'], ['3', '3']], [['4', '4'],
|
||||
['5', '5'], ['6', '6']]]
|
||||
@ -1339,19 +1337,22 @@ fn test_struct_array_of_multi_type_in() {
|
||||
'aaa': '111'
|
||||
}
|
||||
}
|
||||
people := [Person{
|
||||
name: 'ivan'
|
||||
nums: [1, 2, 3]
|
||||
kv: {
|
||||
'aaa': '111'
|
||||
}
|
||||
}, Person{
|
||||
name: 'bob'
|
||||
nums: [2]
|
||||
kv: {
|
||||
'bbb': '222'
|
||||
}
|
||||
}]
|
||||
people := [
|
||||
Person{
|
||||
name: 'ivan'
|
||||
nums: [1, 2, 3]
|
||||
kv: {
|
||||
'aaa': '111'
|
||||
}
|
||||
},
|
||||
Person{
|
||||
name: 'bob'
|
||||
nums: [2]
|
||||
kv: {
|
||||
'bbb': '222'
|
||||
}
|
||||
},
|
||||
]
|
||||
println(ivan in people)
|
||||
assert ivan in people
|
||||
}
|
||||
@ -1364,19 +1365,22 @@ fn test_struct_array_of_multi_type_index() {
|
||||
'aaa': '111'
|
||||
}
|
||||
}
|
||||
people := [Person{
|
||||
name: 'ivan'
|
||||
nums: [1, 2, 3]
|
||||
kv: {
|
||||
'aaa': '111'
|
||||
}
|
||||
}, Person{
|
||||
name: 'bob'
|
||||
nums: [2]
|
||||
kv: {
|
||||
'bbb': '222'
|
||||
}
|
||||
}]
|
||||
people := [
|
||||
Person{
|
||||
name: 'ivan'
|
||||
nums: [1, 2, 3]
|
||||
kv: {
|
||||
'aaa': '111'
|
||||
}
|
||||
},
|
||||
Person{
|
||||
name: 'bob'
|
||||
nums: [2]
|
||||
kv: {
|
||||
'bbb': '222'
|
||||
}
|
||||
},
|
||||
]
|
||||
println(people.index(ivan))
|
||||
assert people.index(ivan) == 0
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ fn test_strip_margins_white_space_after_delim() {
|
||||
|
||||
fn test_strip_margins_alternate_delim() {
|
||||
alternate_delimiter := ['This has a different delim,', 'but that is ok',
|
||||
'because everything works',
|
||||
].join('\n')
|
||||
'because everything works'].join('\n')
|
||||
alternate_delimiter_stripped := 'This has a different delim,
|
||||
#but that is ok
|
||||
#because everything works'.strip_margin_custom(`#`)
|
||||
@ -48,8 +47,7 @@ fn test_strip_margins_multiple_delims_after_first() {
|
||||
fn test_strip_margins_uneven_delims() {
|
||||
uneven_delims := ["It doesn't matter if the delims are uneven,",
|
||||
'The text will still be delimited correctly.', 'Maybe not everything needs 3 lines?',
|
||||
'Let us go for 4 then',
|
||||
].join('\n')
|
||||
'Let us go for 4 then'].join('\n')
|
||||
uneven_delims_stripped := "It doesn't matter if the delims are uneven,
|
||||
|The text will still be delimited correctly.
|
||||
|Maybe not everything needs 3 lines?
|
||||
@ -59,8 +57,7 @@ fn test_strip_margins_uneven_delims() {
|
||||
|
||||
fn test_strip_margins_multiple_blank_lines() {
|
||||
multi_blank_lines := ['Multiple blank lines will be removed.',
|
||||
' I actually consider this a feature.',
|
||||
].join('\n')
|
||||
' I actually consider this a feature.'].join('\n')
|
||||
multi_blank_lines_stripped := 'Multiple blank lines will be removed.
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user