From b61933e81c7faa3f6047889c27e457140b614202 Mon Sep 17 00:00:00 2001 From: hthieu1110 Date: Sat, 21 Sep 2024 07:14:07 +0700 Subject: [PATCH 1/6] feat: pre-register test1 user to make interaction with boards easier --- .../gno.land/r/demo/users/preregister.gno | 3 +++ .../gno.land/r/demo/users/z_13_filetest.gno | 23 +++++++++++++++++++ .../gno.land/r/demo/users/z_5_filetest.gno | 1 + 3 files changed, 27 insertions(+) create mode 100644 examples/gno.land/r/demo/users/z_13_filetest.gno diff --git a/examples/gno.land/r/demo/users/preregister.gno b/examples/gno.land/r/demo/users/preregister.gno index a6377c54938..e87bb478d4e 100644 --- a/examples/gno.land/r/demo/users/preregister.gno +++ b/examples/gno.land/r/demo/users/preregister.gno @@ -26,6 +26,9 @@ var preRegisteredUsers = []struct { {"nt", "g15ge0ae9077eh40erwrn2eq0xw6wupwqthpv34l"}, // -> @r_nt {"sys", "g1r929wt2qplfawe4lvqv9zuwfdcz4vxdun7qh8l"}, // -> @r_sys {"x", "g164sdpew3c2t3rvxj3kmfv7c7ujlvcw2punzzuz"}, // -> @r_x + + // test1 user + {"test1", "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5"}, // -> @test1 } func init() { diff --git a/examples/gno.land/r/demo/users/z_13_filetest.gno b/examples/gno.land/r/demo/users/z_13_filetest.gno new file mode 100644 index 00000000000..b7f5caeffea --- /dev/null +++ b/examples/gno.land/r/demo/users/z_13_filetest.gno @@ -0,0 +1,23 @@ +package main + +// SEND: 200000000ugnot + +import ( + "strconv" + + "gno.land/r/demo/users" +) + +func main() { + { + // Verify pre-registered test1 user + names := users.ListUsersByPrefix("test1", 1) + println("# names: " + strconv.Itoa(len(names))) + println("name: " + names[0]) + } +} + +// Output: +// # names: 1 +// name: test1 + diff --git a/examples/gno.land/r/demo/users/z_5_filetest.gno b/examples/gno.land/r/demo/users/z_5_filetest.gno index 4ab68ec0e0b..31e482b7388 100644 --- a/examples/gno.land/r/demo/users/z_5_filetest.gno +++ b/examples/gno.land/r/demo/users/z_5_filetest.gno @@ -46,6 +46,7 @@ func main() { // * [nt](/r/demo/users:nt) // * [satoshi](/r/demo/users:satoshi) // * [sys](/r/demo/users:sys) +// * [test1](/r/demo/users:test1) // * [x](/r/demo/users:x) // // ======================================== From e94f97fa39343b1b94c7342ac8db49d88f8d3920 Mon Sep 17 00:00:00 2001 From: hthieu1110 Date: Sat, 21 Sep 2024 23:01:17 +0700 Subject: [PATCH 2/6] chore: fix fmt --- examples/gno.land/r/demo/users/z_13_filetest.gno | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/gno.land/r/demo/users/z_13_filetest.gno b/examples/gno.land/r/demo/users/z_13_filetest.gno index b7f5caeffea..6ef312dc41c 100644 --- a/examples/gno.land/r/demo/users/z_13_filetest.gno +++ b/examples/gno.land/r/demo/users/z_13_filetest.gno @@ -20,4 +20,3 @@ func main() { // Output: // # names: 1 // name: test1 - From f598f1fb05518d0a1de57220064a33f82852afbb Mon Sep 17 00:00:00 2001 From: hthieu1110 Date: Wed, 25 Sep 2024 22:37:17 +0700 Subject: [PATCH 3/6] chore: refactor tests --- examples/gno.land/r/demo/users/gno.mod | 1 + examples/gno.land/r/demo/users/users_test.gno | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 examples/gno.land/r/demo/users/users_test.gno diff --git a/examples/gno.land/r/demo/users/gno.mod b/examples/gno.land/r/demo/users/gno.mod index 61b11c09b80..b6f6e640c36 100644 --- a/examples/gno.land/r/demo/users/gno.mod +++ b/examples/gno.land/r/demo/users/gno.mod @@ -4,4 +4,5 @@ require ( gno.land/p/demo/avl v0.0.0-latest gno.land/p/demo/avlhelpers v0.0.0-latest gno.land/p/demo/users v0.0.0-latest + gno.land/p/demo/uassert v0.0.0-latest ) diff --git a/examples/gno.land/r/demo/users/users_test.gno b/examples/gno.land/r/demo/users/users_test.gno new file mode 100644 index 00000000000..cd664867ebc --- /dev/null +++ b/examples/gno.land/r/demo/users/users_test.gno @@ -0,0 +1,14 @@ +package users + +import ( + "testing" + "strconv" + + "gno.land/p/demo/uassert" +) + +func TestPreRegisteredTest1(t *testing.T) { + names := ListUsersByPrefix("test1", 1) + uassert.Equal(t, len(names), 1) + uassert.Equal(t, names[0], "test1") +} From eba2af148288d6674364bbad6e5de4833ff870cf Mon Sep 17 00:00:00 2001 From: hthieu1110 Date: Wed, 25 Sep 2024 22:46:01 +0700 Subject: [PATCH 4/6] chore: fmt code --- examples/gno.land/r/demo/users/users_test.gno | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/gno.land/r/demo/users/users_test.gno b/examples/gno.land/r/demo/users/users_test.gno index cd664867ebc..864793dc514 100644 --- a/examples/gno.land/r/demo/users/users_test.gno +++ b/examples/gno.land/r/demo/users/users_test.gno @@ -2,7 +2,6 @@ package users import ( "testing" - "strconv" "gno.land/p/demo/uassert" ) From 461eb123d63c1d6430f3b43c8d5c33ba85965fe0 Mon Sep 17 00:00:00 2001 From: hthieu1110 Date: Wed, 25 Sep 2024 23:06:03 +0700 Subject: [PATCH 5/6] chore: tidy --- examples/gno.land/r/demo/users/gno.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gno.land/r/demo/users/gno.mod b/examples/gno.land/r/demo/users/gno.mod index b6f6e640c36..cdef52b6952 100644 --- a/examples/gno.land/r/demo/users/gno.mod +++ b/examples/gno.land/r/demo/users/gno.mod @@ -3,6 +3,6 @@ module gno.land/r/demo/users require ( gno.land/p/demo/avl v0.0.0-latest gno.land/p/demo/avlhelpers v0.0.0-latest - gno.land/p/demo/users v0.0.0-latest gno.land/p/demo/uassert v0.0.0-latest + gno.land/p/demo/users v0.0.0-latest ) From 4dcd8cc6cbc628531be8a9bc1e6ebb83ef2efaf1 Mon Sep 17 00:00:00 2001 From: hthieu1110 Date: Thu, 26 Sep 2024 15:56:27 +0700 Subject: [PATCH 6/6] chore: remove unneeded file --- .../gno.land/r/demo/users/z_13_filetest.gno | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 examples/gno.land/r/demo/users/z_13_filetest.gno diff --git a/examples/gno.land/r/demo/users/z_13_filetest.gno b/examples/gno.land/r/demo/users/z_13_filetest.gno deleted file mode 100644 index 6ef312dc41c..00000000000 --- a/examples/gno.land/r/demo/users/z_13_filetest.gno +++ /dev/null @@ -1,22 +0,0 @@ -package main - -// SEND: 200000000ugnot - -import ( - "strconv" - - "gno.land/r/demo/users" -) - -func main() { - { - // Verify pre-registered test1 user - names := users.ListUsersByPrefix("test1", 1) - println("# names: " + strconv.Itoa(len(names))) - println("name: " + names[0]) - } -} - -// Output: -// # names: 1 -// name: test1