Last active
January 23, 2024 13:23
-
-
Save moul/ccf1e2aff64e7a1f0c5ca5e2d98d7e9a to your computer and use it in GitHub Desktop.
gnokey maketx run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"std" | |
"gno.land/p/demo/bf" | |
"gno.land/p/demo/ufmt" | |
"gno.land/r/demo/tests" | |
"gno.land/r/demo/users" | |
) | |
func Main() { | |
// a comment | |
println("# HELLO WORLD!") | |
println(`## users.Render("")`) | |
println(users.Render("")) | |
println() | |
println(`## for i < 10 {print "hey hey hey!"}`) | |
for i := 0; i < 10; i++ { | |
println(ufmt.Sprintf("%d. hey hey hey!", i)) | |
} | |
println() | |
println("## tests.* & std.*") | |
println("- `tests.CurrentRealmPath`", tests.CurrentRealmPath()) | |
println("- `tests.IsOriginCall`", tests.IsOriginCall()) | |
println("- `tests.GetPrevRealm`", tests.GetPrevRealm()) // XXX: should be the user, not gno.land/r/main | |
println("- `std.GetOrigCaller`", std.GetOrigCaller()) | |
println("- `std.PrevRealm`", std.PrevRealm()) | |
println() | |
println("## stateful check") | |
println(ufmt.Sprintf("- before: %d", tests.Counter())) | |
for i := 0; i < 10; i++ { | |
tests.IncCounter() | |
} | |
println(ufmt.Sprintf("- after: %d", tests.Counter())) | |
println() | |
println("## bf") | |
source := "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------." | |
println("```") | |
println("source: ", source) | |
println("result: ", bf.Execute(source)) | |
println("```") | |
println() | |
println("## complex types") | |
obj := tests.TestRealmObject{Field: "foobar"} | |
println("- before: ", obj.Field) | |
tests.ModifyTestRealmObject(&obj) | |
println("- after: ", obj.Field) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On line 12,
Main
should bemain
.