Skip to content

Commit

Permalink
test (not working)
Browse files Browse the repository at this point in the history
  • Loading branch information
crusso committed Dec 13, 2024
1 parent 67425f7 commit ee545f5
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/run-drun/upgrade-migration.drun
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SKIP ic-ref-run
install $ID upgrade-migration/version0.mo ""
ingress $ID check "DIDL\x00\x00"
upgrade $ID upgrade-migration/version1.mo ""
ingress $ID __motoko_gc_trigger "DIDL\x00\x00"
ingress $ID check "DIDL\x00\x00"
upgrade $ID upgrade-migration/version2.mo ""
ingress $ID __motoko_gc_trigger "DIDL\x00\x00"
ingress $ID check "DIDL\x00\x00"
upgrade $ID upgrade-migration/version2.mo ""
ingress $ID check "DIDL\x00\x00"
12 changes: 12 additions & 0 deletions test/run-drun/upgrade-migration/Migration1.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module {

public func run( o: { var one : [var Nat];
var two : [var Nat];
} ) :
{ var three : [var (Nat,Nat)] } {
{
var three = [var (o.one[0], o.two[0])]
}
}

}
10 changes: 10 additions & 0 deletions test/run-drun/upgrade-migration/Migration2.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module {

public func run( o : { var three : [var (Nat,Nat)] } ) :
{ var four : [var (Nat,Nat)] } {
{
var four = o.three;
}
}

}
11 changes: 11 additions & 0 deletions test/run-drun/upgrade-migration/version0.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Prim "mo:prim";

actor {
Prim.debugPrint("Version 0");

stable var one : [var Nat] = [var 1,2];
stable var two : [var Nat] = [var 1,2];

public func check(): async() {
};
};
14 changes: 14 additions & 0 deletions test/run-drun/upgrade-migration/version1.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Prim "mo:prim";
import Migration "Migration1";

actor {

Prim.debugPrint("Version 1");

stable var version = 0;

stable var three : [var (Nat,Nat)] = [var ];

public func check(): async() {
}
};
13 changes: 13 additions & 0 deletions test/run-drun/upgrade-migration/version2.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Prim "mo:prim";
import Migration "Migration2";

actor [Migration.run] {

Prim.debugPrint("Version 2");

stable var version = 2;
stable var four : [var (Nat,Nat)] = [var];

public func check(): async() {
}
};

0 comments on commit ee545f5

Please sign in to comment.