array: single element array test

pull/2148/head
Alexander Medvednikov 2019-09-28 13:52:02 +03:00
parent 5348c667cc
commit 60eb73adb4
1 changed files with 9 additions and 0 deletions

View File

@ -240,3 +240,12 @@ fn test_struct_print() {
assert b.str() == '{1 2}' assert b.str() == '{1 2}'
assert a.b.str() == '[{1 2}, {1 2}]' assert a.b.str() == '[{1 2}, {1 2}]'
} }
fn test_single_element() {
mut a := [1]
a << 2
assert a.len == 2
assert a[0] == 1
assert a[1] == 2
println(a)
}