diff --git a/test/helloworld.go b/test/helloworld.go index 16c95f00686..9c33cab3bea 100644 --- a/test/helloworld.go +++ b/test/helloworld.go @@ -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() { diff --git a/test/if.go b/test/if.go index 13955781f90..25cc141648b 100644 --- a/test/if.go +++ b/test/if.go @@ -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) { diff --git a/test/import.go b/test/import.go index a02a4ad8a49..d135cd28451 100644 --- a/test/import.go +++ b/test/import.go @@ -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 diff --git a/test/import1.go b/test/import1.go index f5b8926a70a..56b29d58c06 100644 --- a/test/import1.go +++ b/test/import1.go @@ -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 diff --git a/test/import2.go b/test/import2.go index 0efc285fac8..0acfabcc182 100644 --- a/test/import2.go +++ b/test/import2.go @@ -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) diff --git a/test/import3.go b/test/import3.go index e4900b93ddc..274fcfe42ab 100644 --- a/test/import3.go +++ b/test/import3.go @@ -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 diff --git a/test/import4.go b/test/import4.go index 1ae1d0e4ad3..cbfebf7e184 100644 --- a/test/import4.go +++ b/test/import4.go @@ -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" diff --git a/test/import5.go b/test/import5.go index acd03c9ce9f..54d22fd9e18 100644 --- a/test/import5.go +++ b/test/import5.go @@ -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 diff --git a/test/index.go b/test/index.go index 38aa33dd305..eb0c45495dc 100644 --- a/test/index.go +++ b/test/index.go @@ -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 diff --git a/test/indirect.go b/test/indirect.go index df8d3c73661..bb20f3009bf 100644 --- a/test/indirect.go +++ b/test/indirect.go @@ -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 diff --git a/test/indirect1.go b/test/indirect1.go index e49eeb06508..51da4cc7c45 100644 --- a/test/indirect1.go +++ b/test/indirect1.go @@ -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 diff --git a/test/init.go b/test/init.go index 0146f4b3ee6..f4689443cf1 100644 --- a/test/init.go +++ b/test/init.go @@ -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" diff --git a/test/initialize.go b/test/initialize.go index 5bab5a708d6..1307e020961 100644 --- a/test/initialize.go +++ b/test/initialize.go @@ -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" diff --git a/test/initializerr.go b/test/initializerr.go index c2703e3eb4b..48908c34786 100644 --- a/test/initializerr.go +++ b/test/initializerr.go @@ -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 { diff --git a/test/int_lit.go b/test/int_lit.go index a109fa9574a..78deaea1302 100644 --- a/test/int_lit.go +++ b/test/int_lit.go @@ -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" diff --git a/test/intcvt.go b/test/intcvt.go index 81b04effdc6..3920528a403 100644 --- a/test/intcvt.go +++ b/test/intcvt.go @@ -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 ( diff --git a/test/iota.go b/test/iota.go index 7e9e3527978..7187dbe335e 100644 --- a/test/iota.go +++ b/test/iota.go @@ -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) { diff --git a/test/label.go b/test/label.go index 8f2df4ccbca..b30c27ec44b 100644 --- a/test/label.go +++ b/test/label.go @@ -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 diff --git a/test/label1.go b/test/label1.go index 8a192c2910a..f923a18820e 100644 --- a/test/label1.go +++ b/test/label1.go @@ -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 diff --git a/test/linkx.go b/test/linkx.go index caa815a391f..d2c9545679b 100644 --- a/test/linkx.go +++ b/test/linkx.go @@ -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 diff --git a/test/literal.go b/test/literal.go index 396d75c01f6..ba185fc9ace 100644 --- a/test/literal.go +++ b/test/literal.go @@ -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 diff --git a/test/mallocfin.go b/test/mallocfin.go index 2f9f8386da1..be6d79b2b8e 100644 --- a/test/mallocfin.go +++ b/test/mallocfin.go @@ -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 diff --git a/test/map.go b/test/map.go index c7f1d05a981..6dec0dfd719 100644 --- a/test/map.go +++ b/test/map.go @@ -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 ( diff --git a/test/map1.go b/test/map1.go index 44708c11bb2..369e49da5d0 100644 --- a/test/map1.go +++ b/test/map1.go @@ -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() {} diff --git a/test/method.go b/test/method.go index 40b42ac7aa6..6080ce5a770 100644 --- a/test/method.go +++ b/test/method.go @@ -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 diff --git a/test/method1.go b/test/method1.go index bbbdbfa1c19..365b8ca553d 100644 --- a/test/method1.go +++ b/test/method1.go @@ -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 { } diff --git a/test/method2.go b/test/method2.go index 7db1c3abb5d..b63da10dc69 100644 --- a/test/method2.go +++ b/test/method2.go @@ -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 { diff --git a/test/method3.go b/test/method3.go index 5711ffd94ca..fd64771527e 100644 --- a/test/method3.go +++ b/test/method3.go @@ -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