...
Run Format

Source file src/cmd/fix/gotypes_test.go

Documentation: cmd/fix

     1  // Copyright 2012 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 init() {
     8  	addTestCases(gotypesTests, gotypes)
     9  }
    10  
    11  var gotypesTests = []testCase{
    12  	{
    13  		Name: "gotypes.0",
    14  		In: `package main
    15  
    16  import "golang.org/x/tools/go/types"
    17  import "golang.org/x/tools/go/exact"
    18  
    19  var _ = exact.Kind
    20  
    21  func f() {
    22  	_ = exact.MakeBool(true)
    23  }
    24  `,
    25  		Out: `package main
    26  
    27  import "go/types"
    28  import "go/constant"
    29  
    30  var _ = constant.Kind
    31  
    32  func f() {
    33  	_ = constant.MakeBool(true)
    34  }
    35  `,
    36  	},
    37  	{
    38  		Name: "gotypes.1",
    39  		In: `package main
    40  
    41  import "golang.org/x/tools/go/types"
    42  import foo "golang.org/x/tools/go/exact"
    43  
    44  var _ = foo.Kind
    45  
    46  func f() {
    47  	_ = foo.MakeBool(true)
    48  }
    49  `,
    50  		Out: `package main
    51  
    52  import "go/types"
    53  import "go/constant"
    54  
    55  var _ = foo.Kind
    56  
    57  func f() {
    58  	_ = foo.MakeBool(true)
    59  }
    60  `,
    61  	},
    62  	{
    63  		Name: "gotypes.0",
    64  		In: `package main
    65  
    66  import "golang.org/x/tools/go/types"
    67  import "golang.org/x/tools/go/exact"
    68  
    69  var _ = exact.Kind
    70  var constant = 23 // Use of new package name.
    71  
    72  func f() {
    73  	_ = exact.MakeBool(true)
    74  }
    75  `,
    76  		Out: `package main
    77  
    78  import "go/types"
    79  import "go/constant"
    80  
    81  var _ = constant_.Kind
    82  var constant = 23 // Use of new package name.
    83  
    84  func f() {
    85  	_ = constant_.MakeBool(true)
    86  }
    87  `,
    88  	},
    89  }
    90  

View as plain text