From 7dfaeeb9713f506525af8f4d7eb4a38add2a3085 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Thu, 10 Aug 2023 12:54:33 +0200 Subject: [PATCH] fix: improve showcase test Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com> --- .../r/demo/showcase/showcase_cmd_filetest.gno | 22 +++++++++++++++ .../demo/showcase/showcase_home_filetest.gno | 28 +++++++++++++++++++ .../showcase/showcase_module_filetest.gno | 23 +++++++++++++++ .../r/demo/showcase/showcase_test.gno | 28 ------------------- .../gno.land/r/demo/showcase/z0_filetest.gno | 13 +++++++-- 5 files changed, 83 insertions(+), 31 deletions(-) create mode 100644 examples/gno.land/r/demo/showcase/showcase_cmd_filetest.gno create mode 100644 examples/gno.land/r/demo/showcase/showcase_home_filetest.gno create mode 100644 examples/gno.land/r/demo/showcase/showcase_module_filetest.gno delete mode 100644 examples/gno.land/r/demo/showcase/showcase_test.gno diff --git a/examples/gno.land/r/demo/showcase/showcase_cmd_filetest.gno b/examples/gno.land/r/demo/showcase/showcase_cmd_filetest.gno new file mode 100644 index 00000000000..ec67fb07e0c --- /dev/null +++ b/examples/gno.land/r/demo/showcase/showcase_cmd_filetest.gno @@ -0,0 +1,22 @@ +package main + +import ( + "gno.land/r/demo/showcase" +) + +func main() { + println(showcase.Render("p-avl/Store-Example")) +} + +// Output: +// # Store Example +// +// +// --- +// +// XXX: show how data is stored in an avl.Tree +// +// +// --- +// +// [[Back]](/r/demo/showcase:p-avl) diff --git a/examples/gno.land/r/demo/showcase/showcase_home_filetest.gno b/examples/gno.land/r/demo/showcase/showcase_home_filetest.gno new file mode 100644 index 00000000000..5ab8fae3f66 --- /dev/null +++ b/examples/gno.land/r/demo/showcase/showcase_home_filetest.gno @@ -0,0 +1,28 @@ +package main + +import ( + "gno.land/r/demo/showcase" +) + +func main() { + println(showcase.Render("")) +} + +// Output: +// # Showcase +// +// +// Package showcase provides a framework for creating small modules that showcase numerous details and expose various usages. +// +// +// +// The primary goal is to facilitate easy demonstration and exploration of small features. +// Modules self-register, expose commands, and demonstrate different aspects. +// This framework encourages experimentation and creativity, allowing developers to easily add new modules while keeping the main files untouched. +// +// - [p/avl](/r/demo/showcase:p-avl) +// - [Store Example](/r/demo/showcase:p-avl/Store-Example) +// - [p/bf](/r/demo/showcase:p-bf) +// - [Example](/r/demo/showcase:p-bf/Example) +// - [p/svg](/r/demo/showcase:p-svg) +// - [Example](/r/demo/showcase:p-svg/Example) diff --git a/examples/gno.land/r/demo/showcase/showcase_module_filetest.gno b/examples/gno.land/r/demo/showcase/showcase_module_filetest.gno new file mode 100644 index 00000000000..7a57580096e --- /dev/null +++ b/examples/gno.land/r/demo/showcase/showcase_module_filetest.gno @@ -0,0 +1,23 @@ +package main + +import ( + "gno.land/r/demo/showcase" +) + +func main() { + println(showcase.Render("p-avl")) +} + +// Output: +// # p/avl +// +// +// Helper to store data in an avl.Tree +// +// - [Store Example](/r/demo/showcase:p-avl/Store-Example) +// +// +// +// --- +// +// [[Back]](/r/demo/showcase:) diff --git a/examples/gno.land/r/demo/showcase/showcase_test.gno b/examples/gno.land/r/demo/showcase/showcase_test.gno deleted file mode 100644 index b4a91dba4a2..00000000000 --- a/examples/gno.land/r/demo/showcase/showcase_test.gno +++ /dev/null @@ -1,28 +0,0 @@ -package showcase - -import ( - "strings" - "testing" -) - -func TestRender(t *testing.T) { - cases := []struct { - path string - shouldContains string - }{ - {"", "Package showcase provides a framework"}, - {"a-404-path", "404"}, - } - - for _, tc := range cases { - name := strings.ReplaceAll(tc.path, "/", "~") - t.Run(name, func(t *testing.T) { - result := Render(tc.path) - println("result", result) - println("shouldContain", tc.shouldContains) - if !strings.Contains(result, tc.shouldContains) { - t.Errorf("expected %q\ngot: %q", result) - } - }) - } -} diff --git a/examples/gno.land/r/demo/showcase/z0_filetest.gno b/examples/gno.land/r/demo/showcase/z0_filetest.gno index fa6973721df..133b3e6b7e3 100644 --- a/examples/gno.land/r/demo/showcase/z0_filetest.gno +++ b/examples/gno.land/r/demo/showcase/z0_filetest.gno @@ -14,7 +14,14 @@ func main() { // Package showcase provides a framework for creating small modules that showcase numerous details and expose various usages. // // -// The primary goal is to facilitate easy demonstration and exploration of small features. Modules self-register, expose commands, and demonstrate different aspects. This framework encourages experimentation and creativity, allowing developers to easily add new modules while keeping the main files untouched. // -// - [p/avl](/r/demo/showcase:p/avl) -// - [p/avl.Example](/r/demo/showcase:p/avl.Example) +// The primary goal is to facilitate easy demonstration and exploration of small features. +// Modules self-register, expose commands, and demonstrate different aspects. +// This framework encourages experimentation and creativity, allowing developers to easily add new modules while keeping the main files untouched. +// +// - [p/avl](/r/demo/showcase:p-avl) +// - [Store Example](/r/demo/showcase:p-avl/Store-Example) +// - [p/bf](/r/demo/showcase:p-bf) +// - [Example](/r/demo/showcase:p-bf/Example) +// - [p/svg](/r/demo/showcase:p-svg) +// - [Example](/r/demo/showcase:p-svg/Example)