Source file test/print.go

     1  // run
     2  
     3  // Copyright 2014 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  // Test internal print routines that are generated
     8  // by the print builtin.  This test is not exhaustive,
     9  // we're just checking that the formatting is correct.
    10  
    11  package main
    12  
    13  func main() {
    14  	println((interface{})(nil)) // printeface
    15  	println((interface {        // printiface
    16  		f()
    17  	})(nil))
    18  	println((map[int]int)(nil)) // printpointer
    19  	println(([]int)(nil))       // printslice
    20  	println(int64(-7))          // printint
    21  	println(uint64(7))          // printuint
    22  	println(uint32(7))          // printuint
    23  	println(uint16(7))          // printuint
    24  	println(uint8(7))           // printuint
    25  	println(uint(7))            // printuint
    26  	println(uintptr(7))         // printuint
    27  	println(8.0)                // printfloat
    28  	println(complex(9.0, 10.0)) // printcomplex
    29  	println(true)               // printbool
    30  	println(false)              // printbool
    31  	println("hello")            // printstring
    32  	println("one", "two")       // printsp
    33  
    34  	// test goprintf
    35  	defer println((interface{})(nil))
    36  	defer println((interface {
    37  		f()
    38  	})(nil))
    39  	defer println((map[int]int)(nil))
    40  	defer println(([]int)(nil))
    41  	defer println(int64(-11))
    42  	defer println(uint64(12))
    43  	defer println(uint32(12))
    44  	defer println(uint16(12))
    45  	defer println(uint8(12))
    46  	defer println(uint(12))
    47  	defer println(uintptr(12))
    48  	defer println(13.0)
    49  	defer println(complex(14.0, 15.0))
    50  	defer println(true)
    51  	defer println(false)
    52  	defer println("hello")
    53  	defer println("one", "two")
    54  }
    55  

View as plain text