]> Cypherpunks.ru repositories - gostls13.git/commitdiff
test: [a-c]: add introductory comments to tests
authorRob Pike <r@golang.org>
Sun, 19 Feb 2012 02:19:43 +0000 (13:19 +1100)
committerRob Pike <r@golang.org>
Sun, 19 Feb 2012 02:19:43 +0000 (13:19 +1100)
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

32 files changed:
test/235.go
test/alias.go
test/alias1.go
test/append.go
test/args.go
test/assign.go
test/assign1.go
test/bigalg.go
test/bigmap.go
test/blank.go
test/blank1.go
test/chancap.go
test/char_lit.go
test/char_lit1.go
test/closure.go
test/cmp.go
test/cmp6.go
test/cmplx.go
test/complit.go
test/complit1.go
test/compos.go
test/const.go
test/const1.go
test/const2.go
test/const3.go
test/convert.go
test/convert1.go
test/convert3.go
test/convlit.go
test/convlit1.go
test/copy.go
test/zerodivide.go

index 65b39972d3606174cf2848af852de069465ba491..6745dde41ab7d8560f32e1ee526c1d6efd63f611 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.
 
+// 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
index d345d7af78e5a7867647df36f65450386cdd1129..ec93a2d101ff0ed42efc8248fa4917ff5c0dd30a 100644 (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"
index 11c18f8bfb350bd73956fe07a4c8922a097360b1..4219af8cd58ac7ecd7f532bbf165660022f693e8 100644 (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{}
 
index 6f35398eab7aa233baaf5c355184230a9072f3ed..3f6251ee507668f6ce9828149417e628066472e3 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.
 
-// Semi-exhaustive test for append()
+// Semi-exhaustive test for the append predeclared function.
 
 package main
 
index ba9a377a6f8e228bffb47fa7a7b25cbe81bf16f0..db624e9c2c92c4cd4dcaa87a0296bacd710316d6 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 os.Args.
+
 package main
 
 import "os"
index 2035df738bb3a63a79f7c1ab1231599469749efc..da0192f838d84c79199450be392c67eb50dac578 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 simple assignment errors are caught by the compiler.
+// Does not compile.
+
 package main
 
 import "sync"
index a80e89b67b1ec9ee24697cb688ba26a6b8fd649c..b9e0325ce8c9757a7f0aabdc16b864f32fadd1d2 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 assignment rules are enforced by the compiler.
+// Does not compile.
+
 package main
 
 type (
index f100998498716d59325eee9188becfa38a05e226..55a15c30abed450ccd38c32f998e239060988bb4 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 internal "algorithms" for objects larger than a word: hashing, equality etc.
+
 package main
 
 type T struct {
index 57330d559de03e8810f7fbc11a8001e7f223d543..37e04984676eafa6bb8c8f15f7261eac9f2b269a 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 behavior of maps with large elements.
+
 package main
 
 func seq(x, y int) [1000]byte {
index 069edfd7480c6a1c6c9666a83ba7bc0753c3d843..961ed153bb8f493b13b4ed533484b39014977f34 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 behavior of the blank identifier (_).
+
 package main
 
 import _ "fmt"
index 63174cca96897cfc47a78b455c7ca348da586a50..c6e038a0d923c7553eda6a89c19077d79e744274 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 incorrect uses of the blank identifer are caught.
+// Does not compile.
+
 package _      // ERROR "invalid package name _"
 
 func main() {
index 8692c2d89f2f371e0d45f068de34f8516e526381..b3e40233f5b29a9a9ff60bfd43e55ac74312facc 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 cap predeclared function applied to channels.
+
 package main
 
 func main() {
index 99be77a570e9fae8b52a24e2263b81110f7c10eb..836c3c1a2d0b0de309abe4b8a6ffa0aabc85668a 100644 (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"
index 7684e0b0b3f4f2614517527c5cf6cd1b3f33c226..489744b6e9888c733d05fa84baa34bbce2f48a1e 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 character literals are detected.
+// Does not compile.
+
 package main
 
 const (
index 26518a13863676d55b852770b5d1a2d1deb1a787..ae38900baaf96715a5851987ae88aac97483fffb 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 behavior of closures.
+
 package main
 
 import "runtime"
index a9d0375b2485464baf108db5cb23a6f3cbbf0618..a56ca6eadddc2732dbf3245a51980c3f4e33e9a3 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 equality and inequality operations.
+
 package main
 
 import "unsafe"
index 1e286750ab5c58b9956c0a023625031aceaba357..7d99aae18b322ac4ca889e8d91492b3aefc08436 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 incorrect comparisons are detected.
+// Does not compile.
+
 package main
 
 func use(bool) {}
index fe05d2defaa7c619a30792643eed2d948b8e112a..248672e7dd5076dda87a359fad00338e39149f74 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 incorrect invocations of the complex predeclared function are detected.
+// Does not compile.
+
 package main
 
 var (
index 164829761c352875aaf9cfacdd34249bffde45f4..649be6d4d39ce02c2c4a8954680825a7f2ac00ed 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 composite literals.
+
 package main
 
 type T struct {
index d36864e61944db6e89c8822b8a3c3978029cf6eb..521401d73936c9a78bcc7518bb76e91893cea847 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 composite literals are detected.
+// Does not compile.
+
 package main
 
 var m map[int][3]int
index 65aca4f1e04596f7f7e3132a59579eb10a96f928..de688b39bb60c146ca3f70cc990963fed7ddd058 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 returning &T{} from a function causes an allocation.
+
 package main
 
 type T struct {
index 966860a9125a83f0dca223eb28d7f425f1194f9f..80fbfaf3ea0b2e3b46e6bced8329a1c8cd850e85 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 simple boolean and numeric constants.
+
 package main
 
 const (
index 53c194041e1a1f50d5e057684d9328e0e652b9a5..b24d274faa4f5aa231f801aa2ccca4b4673d1b34 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 overflow is detected when using numeric constants.
+// Does not compile.
+
 package main
 
 type I interface{}
index f88b041a003f059b2bc5c0a274ea3eacd4ba4d8c..97d3d4c7d07f64fad2110dd9cc3021ee03ae1874 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 large integer constant expressions cause overflow.
+// Does not compile.
+
 package main
 
 const (
index 4500b2099064028e0be6c17be43aad750fcd44db..3f4e3d1ae6fa9adf095afe91e176daa3708fe86b 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 typed integer constants.
+
 package main
 
 import "fmt"
index 8e2b9fa7bf6b07424d1b6bfce8579baaea93e408..7280edf333cdc841b3d762d68a5684b66f6a0c3d 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 types of constant expressions, using reflect.
+
 package main
 
 import "reflect"
index 9dadbee96cc63939ecfbaac28b6493109f3116ae..0f417a33804e3db4e787b2065e308583d5bf32ba 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 conversions involving strings are detected.
+// Does not compile.
+
 package main
 
 type Tbyte []byte
index 336a3fa801abbef5bd9be5786f31898f99c7e034..143aff04f6a472e7bb2728208ad30e4b1d93ac55 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 allowed and disallowed conversions.
+// Does not compile.
+
 package main
 
 // everything here is legal except the ERROR line
index 964481dc974da3313011e10bba37f01271aafd25..8a6145d2a0bed8cc6623f5f79aa773df26a16f6c 100644 (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"
index 09d96f0fd67737b3eb082c4d4bf9ae78c64a3dbb..c06bd74438373a92a900b3273dbd3a369a0f611a 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 composite literals are detected.
+// Does not compile.
+
 package main
 
 var a = []int { "a" }; // ERROR "conver|incompatible|cannot"
index 2abf413f9519eee721fbc2be558a409aa7b945da..65ffb6ff8f5d573c84830a160f6d4ebeaeab0e79 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.
 
-// Semi-exhaustive test for copy()
+// Semi-exhaustive test for the copy predeclared function.
 
 package main
 
index b88b7fc6878843f1fdbeb36d1c2d19f3dec0d416..673d1d18d81f4d68c208b905198f5abfa3faeb74 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 zero division causes a panic.
+
 package main
 
 import (