]> Cypherpunks.ru repositories - gostls13.git/blob - test/label.go
test: use testlib (fourth 100)
[gostls13.git] / test / label.go
1 // errorcheck
2
3 // Copyright 2011 The Go Authors.  All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 // Pass 1 label errors.
8
9 package main
10
11 var x int
12
13 func f() {
14 L1: // ERROR "label .*L1.* defined and not used"
15         for {
16         }
17 L2: // ERROR "label .*L2.* defined and not used"
18         select {
19         }
20 L3: // ERROR "label .*L3.* defined and not used"
21         switch {
22         }
23 L4: // ERROR "label .*L4.* defined and not used"
24         if true {
25         }
26 L5: // ERROR "label .*L5.* defined and not used"
27         f()
28 L6: // GCCGO_ERROR "previous"
29         f()
30 L6: // ERROR "label .*L6.* already defined"
31         f()
32         if x == 20 {
33                 goto L6
34         }
35
36 L7:
37         for {
38                 break L7
39         }
40
41 L8:
42         for {
43                 if x == 21 {
44                         continue L8
45                 }
46         }
47
48 L9:
49         switch {
50         case true:
51                 break L9
52         defalt: // ERROR "label .*defalt.* defined and not used"
53         }
54
55 L10:
56         select {
57         default:
58                 break L10
59         }
60 }