GoPLS Viewer

Home|gopls/cmd/stringer/testdata/vary_day.go
1// Copyright 2018 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// This file is the same as day.go except the constants have different values.
6
7package main
8
9import "fmt"
10
11type Day int
12
13const (
14    Sunday Day = iota
15    Monday
16    Tuesday
17    Wednesday
18    Thursday
19    Friday
20    Saturday
21)
22
23func main() {
24    ck(Monday"Monday")
25    ck(Tuesday"Tuesday")
26    ck(Wednesday"Wednesday")
27    ck(Thursday"Thursday")
28    ck(Friday"Friday")
29    ck(Saturday"Saturday")
30    ck(Sunday"Sunday")
31    ck(-127"Day(-127)")
32    ck(127"Day(127)")
33}
34
35func ck(day Daystr string) {
36    if fmt.Sprint(day) != str {
37        panic("day.go: " + str)
38    }
39}
40
MembersX
Sunday
Members
X