GoPLS Viewer

Home|gopls/cmd/stringer/testdata/unum2.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 - check maximum size
6
7package main
8
9import "fmt"
10
11type Unum2 uint8
12
13const (
14    Zero Unum2 = iota
15    One
16    Two
17)
18
19func main() {
20    ck(Zero"Zero")
21    ck(One"One")
22    ck(Two"Two")
23    ck(3"Unum2(3)")
24    ck(255"Unum2(255)")
25}
26
27func ck(unum Unum2str string) {
28    if fmt.Sprint(unum) != str {
29        panic("unum.go: " + str)
30    }
31}
32
MembersX
Unum2
Zero
Members
X