Source file test/typeparam/issue49027.dir/main.go

     1  // Copyright 2021 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  import (
     8  	"./a"
     9  	"fmt"
    10  )
    11  
    12  func main() {
    13  	s := "foo"
    14  	x := a.Conv(s)
    15  	if x != s {
    16  		panic(fmt.Sprintf("got %s wanted %s", x, s))
    17  	}
    18  	y, ok := a.Conv2(s)
    19  	if !ok {
    20  		panic("conversion failed")
    21  	}
    22  	if y != s {
    23  		panic(fmt.Sprintf("got %s wanted %s", y, s))
    24  	}
    25  	z := a.Conv3(s)
    26  	if z != s {
    27  		panic(fmt.Sprintf("got %s wanted %s", z, s))
    28  	}
    29  	w := a.Conv4(a.Mystring(s))
    30  	if w != a.Mystring(s) {
    31  		panic(fmt.Sprintf("got %s wanted %s", w, s))
    32  	}
    33  }
    34  

View as plain text