From 793aa893dfbe8951ef9ef946f8fcaf9a5ba6c041 Mon Sep 17 00:00:00 2001 From: Hariom Verma Date: Mon, 15 Jan 2024 04:27:06 +0530 Subject: [PATCH] chore: fixups --- examples/gno.land/p/demo/grc/grc721/gno.mod | 1 - examples/gno.land/p/demo/microblog/gno.mod | 2 -- .../gno.land/p/demo/microblog/microblog.gno | 1 - examples/gno.land/p/demo/users/types.gno | 2 -- examples/gno.land/r/demo/boards/misc.gno | 3 +- .../gno.land/r/demo/boards/z_4_filetest.gno | 7 ----- .../gno.land/r/demo/foo1155/foo1155_test.gno | 2 +- examples/gno.land/r/demo/foo20/foo20_test.gno | 2 +- .../gno.land/r/demo/foo721/foo721_test.gno | 6 ++-- examples/gno.land/r/demo/microblog/gno.mod | 2 ++ .../demo/microblog/microblog_test.gno | 30 +++++++++---------- 11 files changed, 23 insertions(+), 35 deletions(-) rename examples/gno.land/{p => r}/demo/microblog/microblog_test.gno (52%) diff --git a/examples/gno.land/p/demo/grc/grc721/gno.mod b/examples/gno.land/p/demo/grc/grc721/gno.mod index 061ea2988c3..48a5f4e04b6 100644 --- a/examples/gno.land/p/demo/grc/grc721/gno.mod +++ b/examples/gno.land/p/demo/grc/grc721/gno.mod @@ -2,6 +2,5 @@ module gno.land/p/demo/grc/grc721 require ( gno.land/p/demo/avl v0.0.0-latest - gno.land/p/demo/testutils v0.0.0-latest gno.land/p/demo/ufmt v0.0.0-latest ) diff --git a/examples/gno.land/p/demo/microblog/gno.mod b/examples/gno.land/p/demo/microblog/gno.mod index fe33e1efee9..9bbcfa19e31 100644 --- a/examples/gno.land/p/demo/microblog/gno.mod +++ b/examples/gno.land/p/demo/microblog/gno.mod @@ -2,7 +2,5 @@ module gno.land/p/demo/microblog require ( gno.land/p/demo/avl v0.0.0-latest - gno.land/p/demo/testutils v0.0.0-latest gno.land/p/demo/ufmt v0.0.0-latest - gno.land/p/demo/users v0.0.0-latest ) diff --git a/examples/gno.land/p/demo/microblog/microblog.gno b/examples/gno.land/p/demo/microblog/microblog.gno index 5723a8f7f83..f6d6709f20b 100644 --- a/examples/gno.land/p/demo/microblog/microblog.gno +++ b/examples/gno.land/p/demo/microblog/microblog.gno @@ -9,7 +9,6 @@ import ( "gno.land/p/demo/avl" "gno.land/p/demo/ufmt" - "gno.land/p/demo/users" ) var ( diff --git a/examples/gno.land/p/demo/users/types.gno b/examples/gno.land/p/demo/users/types.gno index 0e4af4bd6ff..d28b6a8ee42 100644 --- a/examples/gno.land/p/demo/users/types.gno +++ b/examples/gno.land/p/demo/users/types.gno @@ -1,7 +1,5 @@ package users -import "std" - type AddressOrName string func (aon AddressOrName) IsName() bool { diff --git a/examples/gno.land/r/demo/boards/misc.gno b/examples/gno.land/r/demo/boards/misc.gno index ca036eb4680..bc561ca7d22 100644 --- a/examples/gno.land/r/demo/boards/misc.gno +++ b/examples/gno.land/r/demo/boards/misc.gno @@ -82,9 +82,8 @@ func displayAddressMD(addr std.Address) string { if user == nil { return "[" + addr.String() + "](/r/demo/users:" + addr.String() + ")" } else { - return "[@" + user.Name() + "](/r/demo/users:" + user.Name() + ")" + return "[@" + user.Name + "](/r/demo/users:" + user.Name + ")" } - return "[@" + user.Name + "](/r/users:" + user.Name + ")" } func usernameOf(addr std.Address) string { diff --git a/examples/gno.land/r/demo/boards/z_4_filetest.gno b/examples/gno.land/r/demo/boards/z_4_filetest.gno index 1ae0ac250a4..d408e06b2b1 100644 --- a/examples/gno.land/r/demo/boards/z_4_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_4_filetest.gno @@ -47,7 +47,6 @@ func main() { // Realm: // switchrealm["gno.land/r/demo/users"] -// switchrealm["gno.land/r/demo/users"] // switchrealm["gno.land/r/demo/boards"] // u[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:101]={ // "Fields": [ @@ -962,11 +961,5 @@ func main() { // switchrealm["gno.land/r/demo/users"] // switchrealm["gno.land/r/demo/users"] // switchrealm["gno.land/r/demo/users"] -// switchrealm["gno.land/r/demo/users"] -// switchrealm["gno.land/r/demo/users"] -// switchrealm["gno.land/r/demo/users"] -// switchrealm["gno.land/r/demo/users"] -// switchrealm["gno.land/r/demo/users"] -// switchrealm["gno.land/r/demo/users"] // switchrealm["gno.land/r/demo/boards"] // switchrealm["gno.land/r/boards_test"] diff --git a/examples/gno.land/r/demo/foo1155/foo1155_test.gno b/examples/gno.land/r/demo/foo1155/foo1155_test.gno index 30663ab2c95..edd17d708fb 100644 --- a/examples/gno.land/r/demo/foo1155/foo1155_test.gno +++ b/examples/gno.land/r/demo/foo1155/foo1155_test.gno @@ -4,7 +4,7 @@ import ( "testing" "gno.land/p/demo/grc/grc1155" - "gno.land/r/demo/users" + "gno.land/p/demo/users" ) func TestFoo721(t *testing.T) { diff --git a/examples/gno.land/r/demo/foo20/foo20_test.gno b/examples/gno.land/r/demo/foo20/foo20_test.gno index 74c7648c2e5..9db0d5f7a6e 100644 --- a/examples/gno.land/r/demo/foo20/foo20_test.gno +++ b/examples/gno.land/r/demo/foo20/foo20_test.gno @@ -4,7 +4,7 @@ import ( "std" "testing" - "gno.land/r/demo/users" + "gno.land/p/demo/users" ) func TestReadOnlyPublicMethods(t *testing.T) { diff --git a/examples/gno.land/r/demo/foo721/foo721_test.gno b/examples/gno.land/r/demo/foo721/foo721_test.gno index c43d6677120..93a7e33f71d 100644 --- a/examples/gno.land/r/demo/foo721/foo721_test.gno +++ b/examples/gno.land/r/demo/foo721/foo721_test.gno @@ -5,11 +5,13 @@ import ( "gno.land/p/demo/grc/grc721" "gno.land/r/demo/users" + + pusers "gno.land/p/demo/users" ) func TestFoo721(t *testing.T) { - admin := users.AddressOrName("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj") - hariom := users.AddressOrName("g1var589z07ppjsjd24ukm4uguzwdt0tw7g47cgm") + admin := pusers.AddressOrName("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj") + hariom := pusers.AddressOrName("g1var589z07ppjsjd24ukm4uguzwdt0tw7g47cgm") for i, tc := range []struct { name string diff --git a/examples/gno.land/r/demo/microblog/gno.mod b/examples/gno.land/r/demo/microblog/gno.mod index b1f121e6efc..3285127b025 100644 --- a/examples/gno.land/r/demo/microblog/gno.mod +++ b/examples/gno.land/r/demo/microblog/gno.mod @@ -1,7 +1,9 @@ module gno.land/r/demo/microblog require ( + gno.land/p/demo/avl v0.0.0-latest gno.land/p/demo/microblog v0.0.0-latest + gno.land/p/demo/testutils v0.0.0-latest gno.land/p/demo/ufmt v0.0.0-latest gno.land/r/demo/users v0.0.0-latest ) diff --git a/examples/gno.land/p/demo/microblog/microblog_test.gno b/examples/gno.land/r/demo/microblog/microblog_test.gno similarity index 52% rename from examples/gno.land/p/demo/microblog/microblog_test.gno rename to examples/gno.land/r/demo/microblog/microblog_test.gno index 6d20b55e5cb..83b20286fee 100644 --- a/examples/gno.land/p/demo/microblog/microblog_test.gno +++ b/examples/gno.land/r/demo/microblog/microblog_test.gno @@ -7,60 +7,58 @@ import ( "testing" "gno.land/p/demo/avl" + "gno.land/p/demo/microblog" "gno.land/p/demo/testutils" ) func TestMicroblog(t *testing.T) { const ( - title string = "test microblog" - prefix string = "/r/test" author1 std.Address = testutils.TestAddress("author1") author2 std.Address = testutils.TestAddress("author2") ) std.TestSetOrigCaller(author1) - d := NewMicroblog(title, prefix) - if d.Render("/wrongpath") != "404" { + if Render("/wrongpath") != "404" { t.Fatalf("rendering not giving 404") } - if d.Render("") == "404" { + if Render("") == "404" { t.Fatalf("rendering / should not give 404") } - if err := d.NewPost("goodbyte, web2"); err != nil { + if err := m.NewPost("goodbyte, web2"); err != nil { t.Fatalf("could not create post") } - if _, err := d.GetPage(author1.String()); err != nil { + if _, err := m.GetPage(author1.String()); err != nil { t.Fatalf("silo should exist") } - if _, err := d.GetPage("no such author"); err == nil { + if _, err := m.GetPage("no such author"); err == nil { t.Fatalf("silo should not exist") } std.TestSetOrigCaller(author2) - if err := d.NewPost("hello, web3"); err != nil { + if err := m.NewPost("hello, web3"); err != nil { t.Fatalf("could not create post") } - if err := d.NewPost("hello again, web3"); err != nil { + if err := m.NewPost("hello again, web3"); err != nil { t.Fatalf("could not create post") } - if err := d.NewPost("hi again,\n web4?"); err != nil { + if err := m.NewPost("hi again,\n web4?"); err != nil { t.Fatalf("could not create post") } println("--- MICROBLOG ---\n\n") - if rendering := d.Render(""); rendering != `# test microblog + if rendering := Render(""); rendering != `# gno-based microblog # pages -- [g1v96hg6r0wgc47h6lta047h6lta047h6lm33tq6](/r/testg1v96hg6r0wgc47h6lta047h6lta047h6lm33tq6) -- [g1v96hg6r0wge97h6lta047h6lta047h6lyz7c00](/r/testg1v96hg6r0wge97h6lta047h6lta047h6lyz7c00) +- [g1v96hg6r0wgc47h6lta047h6lta047h6lm33tq6](/r/demo/microblog:g1v96hg6r0wgc47h6lta047h6lta047h6lm33tq6) +- [g1v96hg6r0wge97h6lta047h6lta047h6lyz7c00](/r/demo/microblog:g1v96hg6r0wge97h6lta047h6lta047h6lyz7c00) ` { t.Fatalf("incorrect rendering /: '%s'", rendering) } - if rendering := strings.TrimSpace(d.Render(author1.String())); rendering != `## [g1v96hg6r0wgc47h6lta047h6lta047h6lm33tq6](/r/demo/microblog:g1v96hg6r0wgc47h6lta047h6lta047h6lm33tq6) + if rendering := strings.TrimSpace(Render(author1.String())); rendering != `## [g1v96hg6r0wgc47h6lta047h6lta047h6lm33tq6](/r/demo/microblog:g1v96hg6r0wgc47h6lta047h6lta047h6lm33tq6) joined 2009-13-02, last updated 2009-13-02 @@ -72,7 +70,7 @@ joined 2009-13-02, last updated 2009-13-02 t.Fatalf("incorrect rendering /: '%s'", rendering) } - if rendering := strings.TrimSpace(d.Render(author2.String())); rendering != `## [g1v96hg6r0wge97h6lta047h6lta047h6lyz7c00](/r/demo/microblog:g1v96hg6r0wge97h6lta047h6lta047h6lyz7c00) + if rendering := strings.TrimSpace(Render(author2.String())); rendering != `## [g1v96hg6r0wge97h6lta047h6lta047h6lyz7c00](/r/demo/microblog:g1v96hg6r0wge97h6lta047h6lta047h6lyz7c00) joined 2009-13-02, last updated 2009-13-02