From ee545f5728a87dee14d09d9a1c36c01a2940bdce Mon Sep 17 00:00:00 2001 From: Claudio Russo Date: Fri, 13 Dec 2024 21:35:18 +0000 Subject: [PATCH] test (not working) --- test/run-drun/upgrade-migration.drun | 11 +++++++++++ test/run-drun/upgrade-migration/Migration1.mo | 12 ++++++++++++ test/run-drun/upgrade-migration/Migration2.mo | 10 ++++++++++ test/run-drun/upgrade-migration/version0.mo | 11 +++++++++++ test/run-drun/upgrade-migration/version1.mo | 14 ++++++++++++++ test/run-drun/upgrade-migration/version2.mo | 13 +++++++++++++ 6 files changed, 71 insertions(+) create mode 100644 test/run-drun/upgrade-migration.drun create mode 100644 test/run-drun/upgrade-migration/Migration1.mo create mode 100644 test/run-drun/upgrade-migration/Migration2.mo create mode 100644 test/run-drun/upgrade-migration/version0.mo create mode 100644 test/run-drun/upgrade-migration/version1.mo create mode 100644 test/run-drun/upgrade-migration/version2.mo diff --git a/test/run-drun/upgrade-migration.drun b/test/run-drun/upgrade-migration.drun new file mode 100644 index 00000000000..04de2e4996f --- /dev/null +++ b/test/run-drun/upgrade-migration.drun @@ -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" diff --git a/test/run-drun/upgrade-migration/Migration1.mo b/test/run-drun/upgrade-migration/Migration1.mo new file mode 100644 index 00000000000..8fa5c1ef1b4 --- /dev/null +++ b/test/run-drun/upgrade-migration/Migration1.mo @@ -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])] + } + } + +} \ No newline at end of file diff --git a/test/run-drun/upgrade-migration/Migration2.mo b/test/run-drun/upgrade-migration/Migration2.mo new file mode 100644 index 00000000000..5573827a568 --- /dev/null +++ b/test/run-drun/upgrade-migration/Migration2.mo @@ -0,0 +1,10 @@ +module { + + public func run( o : { var three : [var (Nat,Nat)] } ) : + { var four : [var (Nat,Nat)] } { + { + var four = o.three; + } + } + +} \ No newline at end of file diff --git a/test/run-drun/upgrade-migration/version0.mo b/test/run-drun/upgrade-migration/version0.mo new file mode 100644 index 00000000000..8ae812e0802 --- /dev/null +++ b/test/run-drun/upgrade-migration/version0.mo @@ -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() { + }; +}; diff --git a/test/run-drun/upgrade-migration/version1.mo b/test/run-drun/upgrade-migration/version1.mo new file mode 100644 index 00000000000..a427813e44a --- /dev/null +++ b/test/run-drun/upgrade-migration/version1.mo @@ -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() { + } +}; diff --git a/test/run-drun/upgrade-migration/version2.mo b/test/run-drun/upgrade-migration/version2.mo new file mode 100644 index 00000000000..ca1aeb47ea6 --- /dev/null +++ b/test/run-drun/upgrade-migration/version2.mo @@ -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() { + } +};