Fix acceptance tests to use new syntax.
This commit is contained in:
parent
53fb821b62
commit
5132110d4b
|
@ -10,10 +10,10 @@ fn concat(left: String, right: String) -> String {
|
|||
|
||||
fn is_negative(i: Int) -> Bool {
|
||||
if i < 0 {
|
||||
trace "is negative"
|
||||
trace @"is negative"
|
||||
True
|
||||
} else {
|
||||
trace concat("is", concat(" ", "non-negative"))
|
||||
trace concat(@"is", concat(@" ", @"non-negative"))
|
||||
False
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
[[requirements]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "3b47c89006e7580c2213370d7426ed2a38d2836e"
|
||||
version = "main"
|
||||
source = "github"
|
||||
|
||||
[[packages]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "3b47c89006e7580c2213370d7426ed2a38d2836e"
|
||||
version = "main"
|
||||
requirements = []
|
||||
source = "github"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
name = "aiken-lang/acceptance_test_036"
|
||||
version = "0.0.0"
|
||||
|
||||
dependencies = [
|
||||
{ name = "aiken-lang/stdlib", version = "3b47c89006e7580c2213370d7426ed2a38d2836e", source = "github" },
|
||||
]
|
||||
[[dependencies]]
|
||||
name = 'aiken-lang/stdlib'
|
||||
version = 'main'
|
||||
source = 'github'
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
[[requirements]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "1cedbe85b7c7e9c4036d63d45cad4ced27b0d50b"
|
||||
version = "main"
|
||||
source = "github"
|
||||
|
||||
[[packages]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "1cedbe85b7c7e9c4036d63d45cad4ced27b0d50b"
|
||||
version = "main"
|
||||
requirements = []
|
||||
source = "github"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
name = "aiken-lang/acceptance_test_054"
|
||||
version = "0.0.0"
|
||||
|
||||
dependencies = [
|
||||
{ name = "aiken-lang/stdlib", version = "1cedbe85b7c7e9c4036d63d45cad4ced27b0d50b", source = "github" },
|
||||
]
|
||||
[[dependencies]]
|
||||
name = 'aiken-lang/stdlib'
|
||||
version = 'main'
|
||||
source = 'github'
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
[[requirements]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "3b47c89006e7580c2213370d7426ed2a38d2836e"
|
||||
version = "main"
|
||||
source = "github"
|
||||
|
||||
[[packages]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "3b47c89006e7580c2213370d7426ed2a38d2836e"
|
||||
version = "main"
|
||||
requirements = []
|
||||
source = "github"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
name = "aiken-lang/acceptance_test_055"
|
||||
version = "0.0.0"
|
||||
|
||||
dependencies = [
|
||||
{ name = "aiken-lang/stdlib", version="3b47c89006e7580c2213370d7426ed2a38d2836e", source = "github" },
|
||||
]
|
||||
[[dependencies]]
|
||||
name = 'aiken-lang/stdlib'
|
||||
version = 'main'
|
||||
source = 'github'
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
let foo = Module { name: "tests", docs: [], type_info: (), definitions: [Fn(Function { arguments: [Arg { arg_name: Named { name: "signatories", label: "signatories", location: 18..29 }, location: 18..29, annotation: None, tipo: () }], body: When { location: 35..154, subjects: [Var { location: 40..51, name: "signatories" }], clauses: [Clause { location: 61..115, pattern: [List { location: 61..63, elements: [], tail: None }], alternative_patterns: [], guard: None, then: Trace { kind: Trace, location: 75..109, then: Var { location: 104..109, name: "False" }, text: String { location: 81..97, value: "no signatories" } } }, Clause { location: 120..150, pattern: [List { location: 120..129, elements: [Var { location: 121..124, name: "sig" }], tail: Some(Discard { name: "_", location: 128..129 }) }], alternative_patterns: [], guard: None, then: TraceIfFalse { location: 133..150, value: BinOp { location: 134..148, name: Eq, left: Var { location: 134..137, name: "sig" }, right: String { location: 141..148, value: "#ffff" } } } }] }, doc: None, location: 0..30, name: "must_be_signed", public: false, return_annotation: None, return_type: (), end_position: 155 }), Fn(Function { arguments: [], body: Var { location: 182..186, name: "True" }, doc: None, location: 158..177, name: "must_say_hello", public: false, return_annotation: None, return_type: (), end_position: 187 }), Test(Function { arguments: [], body: BinOp { location: 205..260, name: Or, left: BinOp { location: 205..252, name: And, left: TraceIfFalse { location: 205..231, value: Call { arguments: [CallArg { label: None, location: 220..229, value: List { location: 220..229, elements: [String { location: 221..228, value: "#f000" }], tail: None } }], fun: Var { location: 205..219, name: "must_be_signed" }, location: 205..230 } }, right: TraceIfFalse { location: 235..252, value: Call { arguments: [], fun: Var { location: 235..249, name: "must_say_hello" }, location: 235..251 } } }, right: Var { location: 256..260, name: "True" } }, doc: None, location: 190..200, name: "foo", public: false, return_annotation: None, return_type: (), end_position: 261 })], kind: Lib };
|
|
@ -1,4 +1,4 @@
|
|||
name = 'aiken-lang/acceptance_test_061'
|
||||
name = 'aiken-lang/acceptance_test_063'
|
||||
version = '0.0.0'
|
||||
description = ''
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
fn must_be_signed(signatories) {
|
||||
when signatories is {
|
||||
[] -> {
|
||||
trace "no signatories"
|
||||
trace @"no signatories"
|
||||
False
|
||||
}
|
||||
[sig, ..] -> (sig == "#ffff")?
|
||||
|
|
|
@ -28,7 +28,7 @@ fn assert_purpose(purpose) {
|
|||
ref.transaction_id == TransactionId(
|
||||
#"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
) && ref.output_index == 0
|
||||
_ -> error "script purpose isn't 'Spend'"
|
||||
_ -> error @"script purpose isn't 'Spend'"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,6 @@ fn assert_outputs(transaction) {
|
|||
output.reference_script == None,
|
||||
]
|
||||
|> list.and
|
||||
_ -> error "unexpected number of outputs"
|
||||
_ -> error @"unexpected number of outputs"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ fn assert_outputs(outputs) {
|
|||
when outputs is {
|
||||
[output_1, output_2, ..] ->
|
||||
assert_first_output(output_1) && assert_second_output(output_2)
|
||||
_ -> error "expected transaction to have (at least) 2 outputs"
|
||||
_ -> error @"expected transaction to have (at least) 2 outputs"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ fn assert_second_output(output) {
|
|||
),
|
||||
when output.datum is {
|
||||
InlineDatum(_) -> True
|
||||
_ -> error "expected inline datum"
|
||||
_ -> error @"expected inline datum"
|
||||
},
|
||||
]
|
||||
|> list.and
|
||||
|
|
|
@ -29,7 +29,7 @@ fn assert_mint(purpose, transaction) {
|
|||
let tokens = value.tokens(transaction.mint, policy_id)
|
||||
|
||||
when dict.get(tokens, #"666f6f") is {
|
||||
None -> error "token not found"
|
||||
None -> error @"token not found"
|
||||
Some(quantity) -> quantity == 1337
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,11 +23,11 @@ validator spend {
|
|||
|
||||
[
|
||||
when dict.get(ctx.transaction.withdrawals, alice) is {
|
||||
None -> error "alice's withdrawal not found"
|
||||
None -> error @"alice's withdrawal not found"
|
||||
Some(value) -> value == 42
|
||||
},
|
||||
when dict.get(ctx.transaction.withdrawals, bob) is {
|
||||
None -> error "bob's withdrawal not found"
|
||||
None -> error @"bob's withdrawal not found"
|
||||
Some(value) -> value == 14
|
||||
},
|
||||
dict.keys(ctx.transaction.withdrawals) == [alice, bob],
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
[[requirements]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "43d8e740ffdf5febc59e51b7f0d5f8506115340c"
|
||||
version = "main"
|
||||
source = "github"
|
||||
|
||||
[[packages]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "43d8e740ffdf5febc59e51b7f0d5f8506115340c"
|
||||
version = "main"
|
||||
requirements = []
|
||||
source = "github"
|
||||
|
|
|
@ -2,6 +2,8 @@ name = "aiken-lang/hello_world"
|
|||
version = "1.0.0"
|
||||
licences = ["Apache-2.0"]
|
||||
description = "Aiken contracts for project 'aiken-lang/hello_world'"
|
||||
dependencies = [
|
||||
{ name = "aiken-lang/stdlib", version = "43d8e740ffdf5febc59e51b7f0d5f8506115340c", source = "github" },
|
||||
]
|
||||
|
||||
[[dependencies]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "main"
|
||||
source = "github"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use aiken/hash.{Blake2b_224, Hash}
|
||||
use aiken/list
|
||||
use aiken/string
|
||||
use aiken/transaction.{ScriptContext}
|
||||
use aiken/transaction/credential.{VerificationKey}
|
||||
|
||||
|
@ -14,7 +13,7 @@ type Redeemer {
|
|||
|
||||
validator spend {
|
||||
fn(datum: Datum, redeemer: Redeemer, context: ScriptContext) -> Bool {
|
||||
let must_say_hello = string.from_bytearray(redeemer.msg) == "Hello, World!"
|
||||
let must_say_hello = redeemer.msg == "Hello, World!"
|
||||
|
||||
let must_be_signed =
|
||||
list.has(context.transaction.extra_signatories, datum.owner)
|
||||
|
@ -22,4 +21,3 @@ validator spend {
|
|||
must_say_hello && must_be_signed
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue