github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/zrealm0.gno (about)

     1  // PKGPATH: gno.land/r/test
     2  package test
     3  
     4  var root interface{}
     5  
     6  func main() {
     7  	println(root)
     8  	root = 1
     9  	println(root)
    10  }
    11  
    12  // Output:
    13  // nil
    14  // 1
    15  
    16  // The below tests that the realm's block (of 1 variable) changed.  The first
    17  // element image in the package (block) is for the "main" function, which
    18  // appears first because function declarations are defined in a file before
    19  // vars.
    20  
    21  // Realm:
    22  // switchrealm["gno.land/r/test"]
    23  // u[a8ada09dee16d791fd406d629fe29bb0ed084a30:2]={
    24  //     "Blank": {},
    25  //     "ObjectInfo": {
    26  //         "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:2",
    27  //         "IsEscaped": true,
    28  //         "ModTime": "3",
    29  //         "RefCount": "2"
    30  //     },
    31  //     "Parent": null,
    32  //     "Source": {
    33  //         "@type": "/gno.RefNode",
    34  //         "BlockNode": null,
    35  //         "Location": {
    36  //             "File": "",
    37  //             "Line": "0",
    38  //             "Nonce": "0",
    39  //             "PkgPath": "gno.land/r/test"
    40  //         }
    41  //     },
    42  //     "Values": [
    43  //         {
    44  //             "T": {
    45  //                 "@type": "/gno.FuncType",
    46  //                 "Params": [],
    47  //                 "Results": []
    48  //             },
    49  //             "V": {
    50  //                 "@type": "/gno.FuncValue",
    51  //                 "Closure": {
    52  //                     "@type": "/gno.RefValue",
    53  //                     "Escaped": true,
    54  //                     "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3"
    55  //                 },
    56  //                 "FileName": "main.gno",
    57  //                 "IsMethod": false,
    58  //                 "Name": "main",
    59  //                 "NativeName": "",
    60  //                 "NativePkg": "",
    61  //                 "PkgPath": "gno.land/r/test",
    62  //                 "Source": {
    63  //                     "@type": "/gno.RefNode",
    64  //                     "BlockNode": null,
    65  //                     "Location": {
    66  //                         "File": "main.gno",
    67  //                         "Line": "6",
    68  //                         "Nonce": "0",
    69  //                         "PkgPath": "gno.land/r/test"
    70  //                     }
    71  //                 },
    72  //                 "Type": {
    73  //                     "@type": "/gno.FuncType",
    74  //                     "Params": [],
    75  //                     "Results": []
    76  //                 }
    77  //             }
    78  //         },
    79  //         {
    80  //             "N": "AQAAAAAAAAA=",
    81  //             "T": {
    82  //                 "@type": "/gno.PrimitiveType",
    83  //                 "value": "32"
    84  //             }
    85  //         }
    86  //     ]
    87  // }