]> Cypherpunks repositories - gostls13.git/commitdiff
test: commentary for [h-m]*.go
authorRob Pike <r@golang.org>
Thu, 23 Feb 2012 07:47:26 +0000 (18:47 +1100)
committerRob Pike <r@golang.org>
Thu, 23 Feb 2012 07:47:26 +0000 (18:47 +1100)
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5674112

28 files changed:
test/helloworld.go
test/if.go
test/import.go
test/import1.go
test/import2.go
test/import3.go
test/import4.go
test/import5.go
test/index.go
test/indirect.go
test/indirect1.go
test/init.go
test/initialize.go
test/initializerr.go
test/int_lit.go
test/intcvt.go
test/iota.go
test/label.go
test/label1.go
test/linkx.go
test/literal.go
test/mallocfin.go
test/map.go
test/map1.go
test/method.go
test/method1.go
test/method2.go
test/method3.go

index 16c95f00686e6669f609946a073d0cd6c621d637..9c33cab3bead337eb60b9156ebbc70e57e198476 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 we can do page 1 of the C book.
+
 package main
 
 func main() {
index 13955781f90f253de4fa5da08372bebeaf4d5ae5..25cc141648b9a65b7555075ad947b1035ad3111d 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 if statements in various forms.
+
 package main
 
 func assertequal(is, shouldbe int, msg string) {
index a02a4ad8a49b9d46c49c34f986c471db4aea718a..d135cd284517fb540e2ff43fb2b6892b72f800ba 100644 (file)
@@ -4,8 +4,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// check that when import gives multiple names
-// to a type, they're still all the same type
+// Test that when import gives multiple names
+// to a single type, they still all refer to the same type.
 
 package main
 
index f5b8926a70add8bae1c7ca4d8f0e26b8323e5ad4..56b29d58c066e0987bd6b46b89b6c1703f2c8953 100644 (file)
@@ -4,7 +4,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// check for import conflicts
+// Verify that import conflicts are detected by the compiler.
+// Does not compile.
 
 package main
 
index 0efc285fac859c7c9791dd3f4399cd70757cac53..0acfabcc1821dcb7742142c8760709e2477e5a60 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.
 
+// Various declarations of exported variables and functions.
+// Imported by import3.go.
+
 package p
 
 var C1 chan <- chan int = (chan<- (chan int))(nil)
index e4900b93ddc706507a339422a641a5ea96dbe203..274fcfe42ab0e9b650c0433bcfdbc1b4d40620e6 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 that all the types from import2.go made it
+// Test that all the types from import2.go made it
 // intact and with the same meaning, by assigning to or using them.
 
 package main
index 1ae1d0e4ad3c59ee3d9225e32af8bf834bf47a46..cbfebf7e1842d1891b35842b33dff09df67093b3 100644 (file)
@@ -4,9 +4,11 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package main
+// Verify that various kinds of "imported and not used"
+// errors are caught by the compiler.
+// Does not compile.
 
-// various kinds of imported and not used
+package main
 
 // standard
 import "fmt"   // ERROR "imported and not used.*fmt"
index acd03c9ce9f13a7c0520eea46903ca06c197dc6b..54d22fd9e183b3fb904ae97cd8c7d520a7e30ca5 100644 (file)
@@ -4,7 +4,9 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// import paths are slash-separated; reject backslash
+// Verify that imports with backslashes are rejected by the compiler.
+// Does not compile.
+// TODO: make more thorough.
 
 package main
 
index 38aa33dd305927ae8d658db75a0295cec827c824..eb0c45495dce28e1e8115d976734171957197c69 100644 (file)
@@ -9,6 +9,7 @@
 // license that can be found in the LICENSE file.
 
 // Generate test of index and slice bounds checks.
+// The output is compiled and run.
 
 package main
 
index df8d3c7366145b1df4299120e2f2285892fd37c6..bb20f3009bfdd010b6806c0e36ddb178d50062c8 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 various safe uses of indirection.
+
 package main
 
 var m0 map[string]int
index e49eeb065086cb2a38224bd9638775347fb9f85e..51da4cc7c4586b82f0121318f6ec545f01591a2c 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.
 
+// Verify that illegal uses of indirection are caught by the compiler.
+// Does not compile.
+
 package main
 
 var m0 map[string]int
index 0146f4b3ee6f55aa0829619d958c952d9d1ea178..f4689443cf1415be71abe719d0c89aaebdecba76 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.
 
+// Verify that erroneous use of init is detected.
+// Does not compile.
+
 package main
 
 import "runtime"
index 5bab5a708d62334b563083619142d3eba6a8c7b3..1307e0209615b9355a44a76632119d72d9f748e7 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 initialization of package-level variables.
+
 package main
 
 import "fmt"
index c2703e3eb4b588a2b0b049941f078563f864ffad..48908c347864084ba64fad28299ac1fee57ebf6c 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.
 
+// Verify that erroneous initialization expressions are caught by the compiler
+// Does not compile.
+
 package main
 
 type S struct {
index a109fa9574ab47d47e25f3a97b68fa881f64fb48..78deaea13020557993bbec27e6547c67428bb418 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 integer literal syntax.
+
 package main
 
 import "os"
index 81b04effdc62c81fe5e33c940fbc7c46bdb80c65..3920528a403bfad15b4f5faee8c63ceab3356846 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 implicit and explicit conversions of constants.
+
 package main
 
 const (
index 7e9e35279784c62cef914874b7d5c82143c0597e..7187dbe335ea42f03ea44942782398b49d45027b 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 iota.
+
 package main
 
 func assert(cond bool, msg string) {
index 8f2df4ccbca11248fa4f48bf87d9432bc89ab905..b30c27ec44b2b35efb0f0c8c3a750e3677a5a01a 100644 (file)
@@ -4,7 +4,9 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Pass 1 label errors.
+// Verify that erroneous labels are caught by the compiler.
+// This set is caught by pass 1.
+// Does not compile.
 
 package main
 
index 8a192c2910a479cca48b81198bf452914a3ff7a1..f923a18820e329c386de32949406b7db957de289 100644 (file)
@@ -4,7 +4,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Pass 2 label errors.
+
+// Verify that erroneous labels are caught by the compiler.
+// This set is caught by pass 2. That's why this file is label1.go.
+// Does not compile.
 
 package main
 
index caa815a391f5b9a92cf8063dbb454ac6a24aec38..d2c9545679b235b3df99554831656539a17c83fd 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 -X facility of the gc linker (6l etc.).
+
 package main
 
 var tbd string
index 396d75c01f6ded6e55060c5367d381e70ebbe1c6..ba185fc9ace9c8d2b76523af30861bf73a1e34d8 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 literal syntax for basic types.
+
 package main
 
 var nbad int
index 2f9f8386da1ee6b767638cb6f8ffe83ba84b95f0..be6d79b2b8e09ed623639972ac9e9f7ff9a411bb 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.
 
-// trivial finalizer test
+// Test basic operation of finalizers.
 
 package main
 
index c7f1d05a981c16478d84bbbbcf015a9f022439f1..6dec0dfd71938b6b57d00e599a1145022396c7ad 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 maps, almost exhaustively.
+
 package main
 
 import (
index 44708c11bb2538a76e8e3b201ce8f16c5b5804c5..369e49da5d0bf4d1683f26f344f8a81435681928 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 map declarations of many types, including erroneous ones.
+// Does not compile.
+
 package main
 
 func main() {}
index 40b42ac7aa68a3df2d223429ec295133a83d4fd9..6080ce5a770f2f1c79127ecd2a51405091dc171a 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 simple methods of various types, with pointer and
+// value receivers.
+
 package main
 
 type S string
index bbbdbfa1c197a423664ef5a0c33351d790209e9f..365b8ca553dafe8490611fc56ca91acd3c4f7564 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.
 
+// Verify that method redeclarations are caught by the compiler.
+// Does not compile.
+
 package main
 
 type T struct { }
index 7db1c3abb5d56027991124b653def39cc85c8a7b..b63da10dc691d45a6e665965927130c23fad3972 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.
 
+// Verify that pointers and interface types cannot be method receivers.
+// Does not compile.
+
 package main
 
 type T struct {
index 5711ffd94ca14b24f3161739c231fda49e81fdce..fd64771527ed07cefb3359189f6ba900193e6842 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.
 
-// test that methods on slices work
+// Test methods on slices.
 
 package main