Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

Playground

gnomod.toml

module = "gno.land/p/nym-moultest123/greet/v0"
gno = "0.9"

[addpkg]
  creator = "g1ml9grtwnpzqn3hre5ve5vjdlmv2srrmpmc0dsv"
  height = 186404
  max_deposit = "5000000ugnot"

greet.gno

// Package greet is a tiny pure package used as a canary: it proves that
// versioned cross-package resolution (gno.land/p/nym-moultest123/greet/v0) works in the
// workspace and in CI. Replace or remove it once real packages land.
package greet

import "strings"

// Greet returns a friendly greeting for name (defaults to "world").
func Greet(name string) string {
	name = strings.TrimSpace(name)
	if name == "" {
		name = "world"
	}
	return "Hello, " + name + "!"
}

greet_test.gno

package greet

import "testing"

func TestGreet(t *testing.T) {
	cases := map[string]string{
		"":      "Hello, world!",
		"  ":    "Hello, world!",
		"moul":  "Hello, moul!",
		" gno ": "Hello, gno!",
	}
	for in, want := range cases {
		if got := Greet(in); got != want {
			t.Errorf("Greet(%q) = %q, want %q", in, got, want)
		}
	}
}