GoPLS Viewer

Home|gopls/cmd/stringer/testdata/num.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// Signed integers spanning zero.
6
7package main
8
9import "fmt"
10
11type Num int
12
13const (
14    m_2 Num = -2 + iota
15    m_1
16    m0
17    m1
18    m2
19)
20
21func main() {
22    ck(-3"Num(-3)")
23    ck(m_2"m_2")
24    ck(m_1"m_1")
25    ck(m0"m0")
26    ck(m1"m1")
27    ck(m2"m2")
28    ck(3"Num(3)")
29}
30
31func ck(num Numstr string) {
32    if fmt.Sprint(num) != str {
33        panic("num.go: " + str)
34    }
35}
36
MembersX
ck.num
Num
m_2
Members
X