]> Cypherpunks.ru repositories - gostls13.git/commitdiff
test/[n-r]*.go: add documentation
authorRob Pike <r@golang.org>
Thu, 23 Feb 2012 23:30:39 +0000 (10:30 +1100)
committerRob Pike <r@golang.org>
Thu, 23 Feb 2012 23:30:39 +0000 (10:30 +1100)
The rename ones needed redoing.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5698054

13 files changed:
test/nil.go
test/nilptr.go
test/parentype.go
test/peano.go
test/printbig.go
test/range.go
test/recover3.go
test/rename.go
test/rename1.go
test/reorder.go
test/reorder2.go
test/rune.go
test/runtime.go

index fd938273961edc123b94813ac13161960703619c..9f7bcbb59fdb6182b2528f82bfd0019382eb62d0 100644 (file)
@@ -4,6 +4,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Test nil.
+
 package main
 
 import (
index 1a489aae963cb45270406331db79b6484a71445a..b784914e590af5124570bb5f53f6f85fa4e15b0d 100644 (file)
@@ -4,6 +4,9 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Test that the implementation catches nil ptr indirection
+// in a large address space.
+
 package main
 
 import "unsafe"
index d7c14f3a26b2841370109bea8e53ca24bef9cb0e..eafa076481a88eebb4feb678b592b626c04f4c00 100644 (file)
@@ -4,6 +4,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Test that types can be parenthesized.
+
 package main
 
 func f(interface{})
index 2cc0ac280fa9836ce9c3d9a2b43e0096fa78c405..745f5153f6bcf7189af6864066ec597c12d0a8ea 100644 (file)
@@ -4,6 +4,9 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Test that heavy recursion works. Simple torture test for
+// segmented stacks: do math in unary by recursion.
+
 package main
 
 type Number *Number
index d867bdc646c14c34807a7a8417e4c7cfb28e2794..6985796f3abc46fa21c96f08e92f018ca2add696 100644 (file)
@@ -4,6 +4,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Test that big numbers work as constants and print can print them.
+
 package main
 
 func main() {
index 7921e447ec81d3e04b80a0809006c30da89f9a49..b0f3ae605a9b103ad6d6c91a25ec875e2e9cd08a 100644 (file)
@@ -4,6 +4,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Test the 'for range' construct.
+
 package main
 
 // test range over channels
index f87547fc3ec180f8b6e37c8c5f9f46f96406ef4a..98700231ef516e21e927ca5f3b2093c016e9ed9c 100644 (file)
@@ -4,6 +4,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Test recovering from runtime errors.
+
 package main
 
 import (
index ab61c57f6fe03dcecbb1647d45b17805a558c558..817a8de79a40791669e86f108c1c5c50a2725762 100644 (file)
@@ -4,70 +4,95 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Test that predeclared names can be redeclared by the user.
+
 package main
 
 import "fmt"
 
 func main() {
        n :=
-               bool +
+               append +
+                       bool +
                        byte +
-                       float +
+                       complex +
+                       complex64 +
+                       complex128 +
+                       cap +
+                       close +
+                       delete +
+                       error +
+                       false +
                        float32 +
                        float64 +
+                       imag +
                        int +
                        int8 +
                        int16 +
                        int32 +
                        int64 +
+                       len +
+                       make +
+                       new +
+                       nil +
+                       panic +
+                       print +
+                       println +
+                       real +
+                       recover +
+                       rune +
+                       string +
+                       true +
                        uint +
                        uint8 +
                        uint16 +
                        uint32 +
                        uint64 +
                        uintptr +
-                       true +
-                       false +
-                       iota +
-                       nil +
-                       cap +
-                       len +
-                       make +
-                       new +
-                       panic +
-                       print +
-                       println
-       if n != 27*28/2 {
-               fmt.Println("BUG: wrong n", n, 27*28/2)
+                       iota
+       if n != NUM*(NUM-1)/2 {
+               fmt.Println("BUG: wrong n", n, NUM*(NUM-1)/2)
        }
 }
 
 const (
-       bool    = 1
-       byte    = 2
-       float   = 3
-       float32 = 4
-       float64 = 5
-       int     = 6
-       int8    = 7
-       int16   = 8
-       int32   = 9
-       int64   = 10
-       uint    = 11
-       uint8   = 12
-       uint16  = 13
-       uint32  = 14
-       uint64  = 15
-       uintptr = 16
-       true    = 17
-       false   = 18
-       iota    = 19
-       nil     = 20
-       cap     = 21
-       len     = 22
-       make    = 23
-       new     = 24
-       panic   = 25
-       print   = 26
-       println = 27
+       append = iota
+       bool
+       byte
+       complex
+       complex64
+       complex128
+       cap
+       close
+       delete
+       error
+       false
+       float32
+       float64
+       imag
+       int
+       int8
+       int16
+       int32
+       int64
+       len
+       make
+       new
+       nil
+       panic
+       print
+       println
+       real
+       recover
+       rune
+       string
+       true
+       uint
+       uint8
+       uint16
+       uint32
+       uint64
+       uintptr
+       NUM
+       iota = 0
 )
index 765fba2ac1586444512c5f685cab25e3a5ac2685..48262fd2b55251f9dd02d5dbc072a41bb8e90c41 100644 (file)
@@ -4,11 +4,14 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Verify that renamed identifiers no longer have their old meaning.
+// Does not compile.
+
 package main
 
 func main() {
        var n byte       // ERROR "not a type|expected type"
-       var y = float(0) // ERROR "cannot call|expected function"
+       var y = float32(0) // ERROR "cannot call|expected function"
        const (
                a = 1 + iota // ERROR "string|incompatible types" "convert iota"
        )
@@ -16,31 +19,43 @@ func main() {
 }
 
 const (
-       bool    = 1
-       byte    = 2
-       float   = 3
-       float32 = 4
-       float64 = 5
-       int     = 6
-       int8    = 7
-       int16   = 8
-       int32   = 9
-       int64   = 10
-       uint    = 11
-       uint8   = 12
-       uint16  = 13
-       uint32  = 14
-       uint64  = 15
-       uintptr = 16
-       true    = 17
-       false   = 18
-       iota    = "abc"
-       nil     = 20
-       cap     = 21
-       len     = 22
-       make    = 23
-       new     = 24
-       panic   = 25
-       print   = 26
-       println = 27
+       append = iota
+       bool
+       byte
+       complex
+       complex64
+       complex128
+       cap
+       close
+       delete
+       error
+       false
+       float32
+       float64
+       imag
+       int
+       int8
+       int16
+       int32
+       int64
+       len
+       make
+       new
+       nil
+       panic
+       print
+       println
+       real
+       recover
+       rune
+       string
+       true
+       uint
+       uint8
+       uint16
+       uint32
+       uint64
+       uintptr
+       NUM
+       iota = "123"
 )
index a98fd8cbf0b24e883622bd35a63c998e8954d77d..007039e8a9b0fe10e8c6b1aba352138fff299124 100644 (file)
@@ -4,7 +4,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Check reordering of assignments.
+// Test reordering of assignments.
 
 package main
 
index 22fefde53015b3dc56eebcf9a51f3ad1928800ce..d91f1d895312017d62569fdbc303bb4fe971e7c4 100644 (file)
@@ -4,7 +4,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// derived from fixedbugs/bug294.go
+// Test reorderings; derived from fixedbugs/bug294.go.
 
 package main
 
index 3d3823e68be5b2bb3081772d6c25e9c71d9b72ae..c013c471d32d63396229af080a63981e60c4beb5 100644 (file)
@@ -4,6 +4,9 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Test rune constants, expressions and types.
+// Compiles but does not run.
+
 package rune
 
 var (
index 3162b3f13e2890bf8bb0104d5cf97a23e7f375c9..89f59e3edb1688dd1f63c4aa758d85de144d1983 100644 (file)
@@ -4,12 +4,13 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// make sure that even if a file imports runtime,
+// Test that even if a file imports runtime,
 // it cannot get at the low-level runtime definitions
-// known to the compiler.  for normal packages
+// known to the compiler.  For normal packages
 // the compiler doesn't even record the lower case
 // functions in its symbol table, but some functions
 // in runtime are hard-coded into the compiler.
+// Does not compile.
 
 package main