ownable_test.gno
1.12 Kb · 37 lines
1package ownable
2
3import (
4 "testing"
5
6 "gno.land/p/nt/uassert/v0"
7)
8
9// This package is an API sketch recovered from an unmerged upstream proposal:
10// it declares the Owner abstraction and its four owner kinds, but And/Or are
11// `panic("not implemented")`. The tests pin that surface so that implementing
12// one is a deliberate, visible change rather than a silent behaviour shift.
13
14func TestCompositionHelpersAreNotImplemented(cur realm, t *testing.T) {
15 uassert.PanicsWithMessage(t, cur, "not implemented", func() { And(nil) })
16 uassert.PanicsWithMessage(t, cur, "not implemented", func() { Or(nil) })
17}
18
19// TestOwnerKindsAreDeclared is a compile-time check that the concrete owner
20// types still exist with their documented shape.
21func TestOwnerKindsAreDeclared(t *testing.T) {
22 var (
23 _ UserOwner
24 _ RealmOwner
25 _ MembstoreOwner
26 _ DAOOwner
27 _ Kind
28 )
29 uassert.True(t, true, "owner kinds are declared")
30}
31
32// TestKindIsAnInt pins Kind's underlying type: it is compared and likely
33// persisted numerically, so a change of base type is breaking.
34func TestKindIsAnInt(t *testing.T) {
35 var k Kind
36 uassert.Equal(t, 0, int(k), "zero Kind is 0")
37}