...

Source file src/cmd/fix/netipv6zone_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(netipv6zoneTests, netipv6zone)
     9  }
    10  
    11  var netipv6zoneTests = []testCase{
    12  	{
    13  		Name: "netipv6zone.0",
    14  		In: `package main
    15  
    16  import "net"
    17  
    18  func f() net.Addr {
    19  	a := &net.IPAddr{ip1}
    20  	sub(&net.UDPAddr{ip2, 12345})
    21  	c := &net.TCPAddr{IP: ip3, Port: 54321}
    22  	d := &net.TCPAddr{ip4, 0}
    23  	p := 1234
    24  	e := &net.TCPAddr{ip4, p}
    25  	return &net.TCPAddr{ip5}, nil
    26  }
    27  `,
    28  		Out: `package main
    29  
    30  import "net"
    31  
    32  func f() net.Addr {
    33  	a := &net.IPAddr{IP: ip1}
    34  	sub(&net.UDPAddr{IP: ip2, Port: 12345})
    35  	c := &net.TCPAddr{IP: ip3, Port: 54321}
    36  	d := &net.TCPAddr{IP: ip4}
    37  	p := 1234
    38  	e := &net.TCPAddr{IP: ip4, Port: p}
    39  	return &net.TCPAddr{IP: ip5}, nil
    40  }
    41  `,
    42  	},
    43  }
    44  

View as plain text