fix: change list_access_to_uplc to properly handle list discards
This commit is contained in:
16
examples/acceptance_tests/070/aiken.lock
Normal file
16
examples/acceptance_tests/070/aiken.lock
Normal file
@@ -0,0 +1,16 @@
|
||||
# This file was generated by Aiken
|
||||
# You typically do not need to edit this file
|
||||
|
||||
[[requirements]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "main"
|
||||
source = "github"
|
||||
|
||||
[[packages]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "main"
|
||||
requirements = []
|
||||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1706674613, nanos_since_epoch = 871553000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"]
|
||||
8
examples/acceptance_tests/070/aiken.toml
Normal file
8
examples/acceptance_tests/070/aiken.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
name = "aiken-lang/acceptance_test_070"
|
||||
version = '0.0.0'
|
||||
description = ''
|
||||
|
||||
[[dependencies]]
|
||||
name = 'aiken-lang/stdlib'
|
||||
version = 'main'
|
||||
source = 'github'
|
||||
47
examples/acceptance_tests/070/lib/tests.ak
Normal file
47
examples/acceptance_tests/070/lib/tests.ak
Normal file
@@ -0,0 +1,47 @@
|
||||
use aiken/list
|
||||
use aiken/transaction.{InlineDatum, Input, OutputReference, TransactionId}
|
||||
|
||||
type OtherInput {
|
||||
output_reference: OutputReference,
|
||||
other: Data,
|
||||
}
|
||||
|
||||
type MyDatum<a> {
|
||||
Constructor1(a)
|
||||
Constructor2
|
||||
}
|
||||
|
||||
test discard_partitions() {
|
||||
let all_inputs =
|
||||
[
|
||||
OtherInput(OutputReference(TransactionId(#"aabb"), 2), 3),
|
||||
OtherInput(OutputReference(TransactionId(#"aabbcc"), 3), 3),
|
||||
]
|
||||
|
||||
let own_out_ref = OutputReference(TransactionId(#"aabb"), 2)
|
||||
|
||||
expect ([_], other_inputs) =
|
||||
list.partition(
|
||||
all_inputs,
|
||||
fn(input) { input.output_reference == own_out_ref },
|
||||
)
|
||||
|
||||
let inputs: List<Input> =
|
||||
[]
|
||||
|
||||
list.all(
|
||||
inputs,
|
||||
fn(input) {
|
||||
expect dat: MyDatum<Int> =
|
||||
when input.output.datum is {
|
||||
InlineDatum(d) -> d
|
||||
_ -> fail @"Not an inline datum"
|
||||
}
|
||||
|
||||
when dat is {
|
||||
Constructor1 { .. } -> True
|
||||
_ -> False
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user