change how expect works on lists and constructors

Add more coverage to acceptance test 40 on expect
This commit is contained in:
Kasey White
2023-02-11 19:58:22 -05:00
committed by Lucas
parent deb2ab8f80
commit 4b1015e0d4
2 changed files with 83 additions and 7 deletions

View File

@@ -16,7 +16,7 @@ pub type Car {
}
}
test update_owner1() {
test expect_ford1() {
let initial_car =
builtin.constr_data(
1,
@@ -31,3 +31,27 @@ test update_owner1() {
expect Ford { owner, wheels, truck_bed_limit, .. }: Car = initial_car
owner == #"" && wheels == 4 && truck_bed_limit == 10000
}
test expect_ford2() {
let initial_car = Ford {remote_connect: #"", owner: #[34,34,34,34,34], wheels: 6, truck_bed_limit: 15000, car_doors: []}
expect Ford { owner, wheels, remote_connect, .. } = initial_car
owner == #[34,34,34,34,34] && wheels == 6 && remote_connect == #""
}
test expect_list1() {
let initial_car = [5,6,7]
expect [a,b,c] = initial_car
a == 5 && b == 6 && c == 7
}
test expect_list2() {
let initial_car = [5,6,7]
expect [a, ..d] = initial_car
a == 5 && d == [6, 7]
}