Commit fc0dc040 authored by Rob Pike's avatar Rob Pike

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
parent 126d475a
......@@ -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
......
......@@ -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"
......
......@@ -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{}
......
......@@ -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
......
......@@ -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"
......
......@@ -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"
......
......@@ -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 (
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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"
......
......@@ -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() {
......
......@@ -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() {
......
// $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"
......
......@@ -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 (
......
......@@ -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"
......
......@@ -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"
......
......@@ -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) {}
......
......@@ -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 (
......
......@@ -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 {
......
......@@ -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
......
......@@ -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 {
......
......@@ -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 (
......
......@@ -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{}
......
......@@ -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 (
......
......@@ -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"
......
......@@ -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"
......
......@@ -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
......
......@@ -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
......
......@@ -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"
......
......@@ -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"
......
......@@ -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
......
......@@ -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 (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment