fix: 2 acceptance tests were throwing errors due to exhaustiveness checker

This commit is contained in:
microproofs 2023-08-06 18:54:01 -04:00 committed by Kasey
parent 1d9878c5ee
commit f7d278a472
2 changed files with 10 additions and 21 deletions

View File

@ -28,8 +28,7 @@ test expect_ford1() {
builtin.list_data([]),
],
)
expect Ford { owner, wheels, truck_bed_limit, .. }: Car =
initial_car
expect Ford { owner, wheels, truck_bed_limit, .. }: Car = initial_car
owner == #"" && wheels == 4 && truck_bed_limit == 10000
}
@ -42,32 +41,28 @@ test expect_ford2() {
truck_bed_limit: 15000,
car_doors: [],
}
expect Ford { owner, wheels, remote_connect, .. } =
initial_car
expect Ford { owner, wheels, remote_connect, .. } = initial_car
owner == #"2222222222" && wheels == 6 && remote_connect == #""
}
test expect_list1() {
let initial_car =
[5, 6, 7]
expect [a, b, c] =
initial_car
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
expect [a, ..d] = initial_car
a == 5 && d == [6, 7]
}
test expect_list3() {
let initial_car =
builtin.list_data([builtin.i_data(5), builtin.i_data(6), builtin.i_data(7)])
expect [a, ..d]: List<Int> =
initial_car
expect [a, ..d]: List<Int> = initial_car
a == 5 && d == [6, 7]
}
@ -76,22 +71,16 @@ type Redeemer {
}
test single_field_expect() {
let redeemer =
CreateVoteBatch { id: #"" }
expect CreateVoteBatch { id } =
redeemer
let redeemer = CreateVoteBatch { id: #"" }
expect CreateVoteBatch { id } = redeemer
id == #""
}
test single_when() {
let redeemer =
CreateVoteBatch { id: #"" }
let redeemer = CreateVoteBatch { id: #"" }
let x =
when redeemer is {
CreateVoteBatch { id } ->
id == #""
_ ->
False
CreateVoteBatch { id } -> id == #""
}
x == True
}

View File

@ -16,10 +16,10 @@ test tuple_when() {
when item is {
(token_policy, _, token_amount) ->
amount == token_amount && policy == token_policy
_ -> False
}
},
)
list.length(filtered) > 0
}