access.gno
0.83 Kb ยท 43 lines
1package testutils
2
3// for testing access. see tests/files/access*.go
4
5// NOTE: non-package variables cannot be overridden, except during init().
6var (
7 TestVar1 int
8 testVar2 int
9)
10
11func init() {
12 TestVar1 = 123
13 testVar2 = 456
14}
15
16type TestAccessStruct struct {
17 PublicField string
18 privateField string
19}
20
21func (tas TestAccessStruct) PublicMethod() string {
22 return tas.PublicField + "/" + tas.privateField
23}
24
25func (tas TestAccessStruct) privateMethod() string {
26 return tas.PublicField + "/" + tas.privateField
27}
28
29func NewTestAccessStruct(pub, priv string) TestAccessStruct {
30 return TestAccessStruct{
31 PublicField: pub,
32 privateField: priv,
33 }
34}
35
36// see access6.g0 etc.
37type PrivateInterface interface {
38 privateMethod() string
39}
40
41func PrintPrivateInterface(pi PrivateInterface) {
42 println("testutils.PrintPrivateInterface", pi.privateMethod())
43}