mirror of
https://github.com/golang/go
synced 2024-11-24 03:00:17 -07:00
test: commentary for [h-m]*.go
R=golang-dev, gri CC=golang-dev https://golang.org/cl/5674112
This commit is contained in:
parent
3391de8df7
commit
501f0b578f
@ -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() {
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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 {
|
||||
|
@ -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"
|
||||
|
@ -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 (
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 (
|
||||
|
@ -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() {}
|
||||
|
@ -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
|
||||
|
@ -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 { }
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user