Skip to content

Commit

Permalink
Add now-necessary type-annotations in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed May 5, 2024
1 parent a1c1da9 commit b30428d
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/acceptance_tests/077/aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1714846140, nanos_since_epoch = 960222000 }, "5ee55dc5ccf269bb493f4cacb32096f0191a6adb2ef39d62a1f79b8c5a8fcc7f"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1714911372, nanos_since_epoch = 250896000 }, "5ee55dc5ccf269bb493f4cacb32096f0191a6adb2ef39d62a1f79b8c5a8fcc7f"]
2 changes: 1 addition & 1 deletion examples/acceptance_tests/077/validators/spend2.ak
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ validator {
}
}

fn find_stuff(context) -> Output {
fn find_stuff(context: ScriptContext) -> Output {
expect Some(stuff) = list.find(context.transaction.outputs, fn(_) { True })
stuff
}
2 changes: 1 addition & 1 deletion examples/acceptance_tests/script_context/aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1714846166, nanos_since_epoch = 809844000 }, "5ee55dc5ccf269bb493f4cacb32096f0191a6adb2ef39d62a1f79b8c5a8fcc7f"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1714913251, nanos_since_epoch = 578539000 }, "5ee55dc5ccf269bb493f4cacb32096f0191a6adb2ef39d62a1f79b8c5a8fcc7f"]
2 changes: 1 addition & 1 deletion examples/acceptance_tests/script_context/plutus.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"plutusVersion": "v2",
"compiler": {
"name": "Aiken",
"version": "v1.0.26-alpha+a44ed4c"
"version": "v1.0.26-alpha+f8607b8"
}
},
"validators": [
Expand Down
12 changes: 6 additions & 6 deletions examples/acceptance_tests/script_context/validators/basic.ak
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use aiken/option
use aiken/transaction.{NoDatum, ScriptContext, Spend, TransactionId}
use aiken/transaction.{NoDatum,
ScriptContext, Spend, Transaction, TransactionId}
use aiken/transaction/credential.{VerificationKeyCredential}
use aiken/transaction/value

Expand All @@ -14,7 +15,7 @@ validator {
}
}

fn assert_id(transaction) {
fn assert_id(transaction: Transaction) {
transaction.id != TransactionId(
#"0000000000000000000000000000000000000000000000000000000000000000",
)
Expand All @@ -30,14 +31,13 @@ fn assert_purpose(purpose) {
}
}

fn assert_fee(transaction) {
fn assert_fee(transaction: Transaction) {
transaction.fee == value.from_lovelace(42)
}

fn assert_outputs(transaction) {
fn assert_outputs(transaction: Transaction) {
when transaction.outputs is {
[output] ->
and {
[output] -> and {
output.value == value.from_lovelace(1000000000),
output.address.payment_credential == VerificationKeyCredential(
#"11111111111111111111111111111111111111111111111111111111",
Expand Down
10 changes: 5 additions & 5 deletions examples/acceptance_tests/script_context/validators/deploy.ak
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use aiken/builtin
use aiken/dict
use aiken/dict.{Dict}
use aiken/hash.{blake2b_256}
use aiken/transaction.{DatumHash, InlineDatum, ScriptContext}
use aiken/transaction.{DatumHash, InlineDatum, Output, ScriptContext}
use aiken/transaction/credential.{Inline, VerificationKeyCredential}

validator {
Expand All @@ -23,7 +23,7 @@ type MyDatum {
MyDatum(Int)
}

fn assert_datums(datums) {
fn assert_datums(datums: Dict<ByteArray, Data>) {
let my_datum = MyDatum(42)

expect Some(datum) =
Expand All @@ -42,7 +42,7 @@ fn assert_outputs(outputs) {
}
}

fn assert_first_output(output) {
fn assert_first_output(output: Output) {
and {
output.datum == DatumHash(
#"fcaa61fb85676101d9e3398a484674e71c45c3fd41b492682f3b0054f4cf3273",
Expand All @@ -53,7 +53,7 @@ fn assert_first_output(output) {
}
}

fn assert_second_output(output) {
fn assert_second_output(output: Output) {
and {
output.address.stake_credential == Some(
Inline(
Expand Down
8 changes: 4 additions & 4 deletions examples/acceptance_tests/script_context/validators/mint.ak
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use aiken/dict
use aiken/list
use aiken/transaction.{Mint, ScriptContext}
use aiken/transaction.{Mint, ScriptContext, Transaction}
use aiken/transaction/value

validator {
Expand All @@ -13,7 +13,7 @@ validator {
}
}

fn assert_purpose(ctx) {
fn assert_purpose(ctx: ScriptContext) {
expect [my_policy_id] =
ctx.transaction.mint
|> value.from_minted_value
Expand All @@ -25,7 +25,7 @@ fn assert_purpose(ctx) {
my_policy_id == policy_id
}

fn assert_mint(purpose, transaction) {
fn assert_mint(purpose, transaction: Transaction) {
expect Mint(policy_id) = purpose
let tokens =
value.tokens(transaction.mint |> value.from_minted_value, policy_id)
Expand All @@ -36,7 +36,7 @@ fn assert_mint(purpose, transaction) {
}
}

fn assert_redeemers(ctx, my_redeemer) {
fn assert_redeemers(ctx: ScriptContext, my_redeemer) {
expect Some(Pair(_, redeemer)) =
list.find(ctx.transaction.redeemers, fn(kv) { kv.1st == ctx.purpose })
my_redeemer == redeemer && list.length(ctx.transaction.redeemers) == 1
Expand Down

0 comments on commit b30428d

Please sign in to comment.