Source file test/retjmp.dir/main.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  package main
     6  
     7  func f()
     8  func leaf()
     9  func leaf2()
    10  
    11  var f1called, f2called, f3called, f4called bool
    12  
    13  func main() {
    14  	f()
    15  	if !f1called {
    16  		panic("f1 not called")
    17  	}
    18  	if !f2called {
    19  		panic("f2 not called")
    20  	}
    21  	leaf()
    22  	if !f3called {
    23  		panic("f3 not called")
    24  	}
    25  	leaf2()
    26  	if !f4called {
    27  		panic("f4 not called")
    28  	}
    29  }
    30  
    31  func f1() { f1called = true }
    32  func f2() { f2called = true }
    33  func f3() { f3called = true }
    34  func f4() { f4called = true }
    35  
    36  func unreachable() {
    37  	panic("unreachable function called")
    38  }
    39  

View as plain text