add assert and record

Record is a more efficient air for making records
Assert guarantees a custom is of a certain variant.
This commit is contained in:
Kasey White
2023-01-13 02:46:02 -05:00
committed by Lucas
parent 1721c3945b
commit 7b023911af
4 changed files with 212 additions and 32 deletions

View File

@@ -7,10 +7,14 @@ pub type Car{
}
// test update_owner2_should_fail(){
// let initial_car: Data = Ford{remote_connect: #[], owner: #[], wheels: 4, truck_bed_limit: 10000}
// assert Honda{ owner, ..} = initial_car
// owner == #[]
// }
test update_owner1(){
let initial_car: Data = Ford{remote_connect: #[], owner: #[], wheels: 4, truck_bed_limit: 10000}
assert Ford{ owner, ..} = initial_car
owner == #[]
}