github.com/HaHadaxigua/yaegi@v1.0.1/_test/type23.go (about)

     1  package main
     2  
     3  import (
     4  	"net/http"
     5  	"net/http/httptest"
     6  )
     7  
     8  func main() {
     9  	var v1 interface{} = 1
    10  	var v2 interface{}
    11  	var v3 http.ResponseWriter = httptest.NewRecorder()
    12  
    13  	if r1, ok := v1.(string); ok {
    14  		_ = r1
    15  		println("unexpected")
    16  	}
    17  	if _, ok := v1.(string); ok {
    18  		println("unexpected")
    19  	}
    20  	if r2, ok := v2.(string); ok {
    21  		_ = r2
    22  		println("unexpected")
    23  	}
    24  	if _, ok := v2.(string); ok {
    25  		println("unexpected")
    26  	}
    27  	if r3, ok := v3.(http.Pusher); ok {
    28  		_ = r3
    29  		println("unexpected")
    30  	}
    31  	if _, ok := v3.(http.Pusher); ok {
    32  		println("unexpected")
    33  	}
    34  	println("bye")
    35  }
    36  
    37  // Output:
    38  // bye