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.

corkscrew_test.gno

0.73 Kb · 25 lines
 1package corkscrew
 2
 3import (
 4	"strings"
 5	"testing"
 6
 7	"gno.land/p/nt/uassert/v0"
 8)
 9
10const ash = address("g1zkzjmyveh7euq83h5zhnhj6mg0d7kr35nphzd2")
11
12func TestOldBottlesRefused(cur realm, t *testing.T) {
13	testing.SetRealm(testing.NewUserRealm(ash))
14	uassert.AbortsContains(t, cur, "after 1900", func() { Shelve(cross(cur), 1700) })
15	Shelve(cross(cur), 1955)
16	uassert.AbortsContains(t, cur, "already shelved", func() { Shelve(cross(cur), 1955) })
17}
18
19func TestYoungBottleIsNotOldest(cur realm, t *testing.T) {
20	testing.SetRealm(testing.NewUserRealm(ash))
21	Shelve(cross(cur), 1990)
22	uassert.AbortsContains(t, cur, "not yours", func() { Open(cross(cur)) })
23	uassert.False(t, captures.Captured(ash))
24	uassert.True(t, strings.Contains(Render(""), "- 1990:"))
25}