Skip to content

Commit

Permalink
[diem-transactional-tests] migrate natives tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vgao1996 authored and bors-libra committed Dec 17, 2021
1 parent 7d3918b commit 98af2df
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
processed 3 tasks

task 2 'run'. lines 18-25:
Events:{
key: 0400000000000000c5e34b925cf6875fec02d4b77adbd2d6
seq_num: 0
type: 0xc5e34b925cf6875fec02d4b77adbd2d6::M::MyEvent
data: "01"
}
{
key: 01000000000000000000000000000000000000000a550c18
seq_num: 0
type: 0x1::DiemAccount::AdminTransactionEvent
data: "0000000000000000"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
module {{default}}::M {
//# init --parent-vasps Alice

// TODO: this should be a Move test. Make it so after we fix the infrastructure.

//# publish
module Alice::M {
use Std::Event;

struct MyEvent has copy, drop, store { b: bool }
Expand All @@ -10,14 +15,11 @@ module {{default}}::M {
}
}


//! new-transaction
//# run --admin-script --signers DiemRoot Alice --show-events
script {
use {{default}}::M;
use Alice::M;

fun main(account: signer) {
let account = &account;
M::emit_event(account);
fun main(_dr: signer, account: signer) {
M::emit_event(&account);
}
}
// check: "Keep(EXECUTED)"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
processed 3 tasks

task 2 'run'. lines 18-25:
Events:{
key: 0400000000000000c5e34b925cf6875fec02d4b77adbd2d6
seq_num: 0
type: 0xc5e34b925cf6875fec02d4b77adbd2d6::M::MyEvent<u64, bool>
data: "01"
}
{
key: 01000000000000000000000000000000000000000a550c18
seq_num: 0
type: 0x1::DiemAccount::AdminTransactionEvent
data: "0000000000000000"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
module {{default}}::M {
//# init --parent-vasps Alice

// TODO: this should be a Move test. Make it so after we fix the infrastructure.

//# publish
module Alice::M {
use Std::Event;

struct MyEvent<phantom T1, phantom T2> has copy, drop, store { b: bool }
Expand All @@ -10,14 +15,11 @@ module {{default}}::M {
}
}


//! new-transaction
//# run --admin-script --signers DiemRoot Alice --show-events
script {
use {{default}}::M;
use Alice::M;

fun main(account: signer) {
let account = &account;
M::emit_event<bool, u64>(account);
fun main(_dr: signer, account: signer) {
M::emit_event<bool, u64>(&account);
}
}
// check: "Keep(EXECUTED)"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
processed 2 tasks

task 1 'run'. lines 5-14:
Events:{
key: 0400000000000000c5e34b925cf6875fec02d4b77adbd2d6
seq_num: 0
type: u64
data: "2a00000000000000"
}
{
key: 01000000000000000000000000000000000000000a550c18
seq_num: 0
type: 0x1::DiemAccount::AdminTransactionEvent
data: "0000000000000000"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//# init --parent-vasps Alice

// TODO: this should be a Move test. Make it so after we fix the infrastructure.

//# run --admin-script --signers DiemRoot Alice --show-events
script {
use Std::Event;

fun main(_dr: signer, account: signer) {
let handle = Event::new_event_handle<u64>(&account);
Event::emit_event(&mut handle, 42);
Event::destroy_handle(handle);
}
}

This file was deleted.

0 comments on commit 98af2df

Please sign in to comment.