GoPLS Viewer

Home|gopls/cmd/stringer/testdata/unum.go
1// Copyright 2014 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Unsigned integers spanning zero.
6
7package main
8
9import "fmt"
10
11type Unum uint8
12
13const (
14    m_2 Unum = iota + 253
15    m_1
16)
17
18const (
19    m0 Unum = iota
20    m1
21    m2
22)
23
24func main() {
25    ck(^Unum(0)-3"Unum(252)")
26    ck(m_2"m_2")
27    ck(m_1"m_1")
28    ck(m0"m0")
29    ck(m1"m1")
30    ck(m2"m2")
31    ck(3"Unum(3)")
32}
33
34func ck(unum Unumstr string) {
35    if fmt.Sprint(unum) != str {
36        panic("unum.go: " + str)
37    }
38}
39
MembersX
Unum
m0
ck.unum
Members
X