v2 / vlib / v / tests / builtin_arrays / array_string_ref_compare_test.v
17 lines · 17 sloc · 413 bytes · a98f6768905c59ea164b0cc805af5c5c924800fc
Raw
1fn test_nested_array_of_string_references_compare_empty_in_mut_loop() {
2 v1 := 'abc'
3 v2 := 'def'
4 mut sec_array := [][]&string{len: 1, init: []&string{}}
5 sec_array[0] << &v1
6 sec_array[0] << &v2
7 mut found_non_empty := false
8 for mut elem in sec_array {
9 if elem != [] {
10 found_non_empty = true
11 assert elem.len == 2
12 assert *elem[0] == 'abc'
13 assert *elem[1] == 'def'
14 }
15 }
16 assert found_non_empty
17}
18