1
0
mirror of https://github.com/golang/go synced 2024-07-03 08:51:14 +00:00

test: [a-c]: add introductory comments to tests

Very few of the compiler regression tests include a comment
saying waht they do. Many are obvious, some are anything but.
I've started with a-c in the top directory. More will follow once
we agree on the approach, correctness, and thoroughness here.
zerodivide.go sneaked in too.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5656100
This commit is contained in:
Rob Pike 2012-02-19 13:19:43 +11:00
parent 126d475a43
commit fc0dc04095
32 changed files with 79 additions and 10 deletions

View 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.
// Solve the 2,3,5 problem (print all numbers with 2, 3, or 5 as factor) using channels.
// Test the solution, silently.
package main
type T chan uint64

View File

@ -4,10 +4,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
// Test that error messages say what the source file says
// (uint8 vs byte, int32 vs. rune).
// Does not compile.
package main
import (
"fmt"

View File

@ -4,11 +4,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
// Test that dynamic interface checks treat byte=uint8
// and rune=int or rune=int32.
package main
func main() {
var x interface{}

View 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.
// Semi-exhaustive test for append()
// Semi-exhaustive test for the append predeclared function.
package main

View 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 os.Args.
package main
import "os"

View 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 simple assignment errors are caught by the compiler.
// Does not compile.
package main
import "sync"

View 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 assignment rules are enforced by the compiler.
// Does not compile.
package main
type (

View 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 internal "algorithms" for objects larger than a word: hashing, equality etc.
package main
type T struct {

View 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 behavior of maps with large elements.
package main
func seq(x, y int) [1000]byte {

View 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 behavior of the blank identifier (_).
package main
import _ "fmt"

View 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 incorrect uses of the blank identifer are caught.
// Does not compile.
package _ // ERROR "invalid package name _"
func main() {

View 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 cap predeclared function applied to channels.
package main
func main() {

View File

@ -1,9 +1,11 @@
// $G $F.go && $L $F.$A &&./$A.out
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test character literal syntax.
package main
import "os"

View 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 character literals are detected.
// Does not compile.
package main
const (

View 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 behavior of closures.
package main
import "runtime"

View 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 equality and inequality operations.
package main
import "unsafe"

View 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 incorrect comparisons are detected.
// Does not compile.
package main
func use(bool) {}

View 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 incorrect invocations of the complex predeclared function are detected.
// Does not compile.
package main
var (

View 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 composite literals.
package main
type T struct {

View 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 composite literals are detected.
// Does not compile.
package main
var m map[int][3]int

View 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 returning &T{} from a function causes an allocation.
package main
type T struct {

View 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 simple boolean and numeric constants.
package main
const (

View 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 overflow is detected when using numeric constants.
// Does not compile.
package main
type I interface{}

View 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 large integer constant expressions cause overflow.
// Does not compile.
package main
const (

View 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 typed integer constants.
package main
import "fmt"

View 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 types of constant expressions, using reflect.
package main
import "reflect"

View 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 conversions involving strings are detected.
// Does not compile.
package main
type Tbyte []byte

View 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 allowed and disallowed conversions.
// Does not compile.
package main
// everything here is legal except the ERROR line

View File

@ -4,11 +4,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Verify that illegal assignments with both explicit and implicit conversions of literals are detected.
// Does not compile.
package main
// explicit conversion of constants is work in progress.
// the ERRORs in this block are debatable, but they're what
// the language spec says for now.
// explicit conversion of constants
var x1 = string(1)
var x2 string = string(1)
var x3 = int(1.5) // ERROR "convert|truncate"

View 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 composite literals are detected.
// Does not compile.
package main
var a = []int { "a" }; // ERROR "conver|incompatible|cannot"

View 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.
// Semi-exhaustive test for copy()
// Semi-exhaustive test for the copy predeclared function.
package main

View 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 zero division causes a panic.
package main
import (