mirror of
https://github.com/golang/go
synced 2024-11-24 14:10:03 -07:00
test/[n-r]*.go: add documentation
The rename ones needed redoing. R=golang-dev, bradfitz, rsc CC=golang-dev https://golang.org/cl/5698054
This commit is contained in:
parent
5b30306fa8
commit
19bab1dc78
@ -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 nil.
|
||||
|
||||
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 that the implementation catches nil ptr indirection
|
||||
// in a large address space.
|
||||
|
||||
package main
|
||||
|
||||
import "unsafe"
|
||||
|
@ -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 types can be parenthesized.
|
||||
|
||||
package main
|
||||
|
||||
func f(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.
|
||||
|
||||
// Test that heavy recursion works. Simple torture test for
|
||||
// segmented stacks: do math in unary by recursion.
|
||||
|
||||
package main
|
||||
|
||||
type Number *Number
|
||||
|
@ -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 big numbers work as constants and print can print them.
|
||||
|
||||
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 the 'for range' construct.
|
||||
|
||||
package main
|
||||
|
||||
// test range over channels
|
||||
|
@ -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 recovering from runtime errors.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
109
test/rename.go
109
test/rename.go
@ -4,70 +4,95 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Test that predeclared names can be redeclared by the user.
|
||||
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
n :=
|
||||
bool +
|
||||
append +
|
||||
bool +
|
||||
byte +
|
||||
float +
|
||||
complex +
|
||||
complex64 +
|
||||
complex128 +
|
||||
cap +
|
||||
close +
|
||||
delete +
|
||||
error +
|
||||
false +
|
||||
float32 +
|
||||
float64 +
|
||||
imag +
|
||||
int +
|
||||
int8 +
|
||||
int16 +
|
||||
int32 +
|
||||
int64 +
|
||||
len +
|
||||
make +
|
||||
new +
|
||||
nil +
|
||||
panic +
|
||||
print +
|
||||
println +
|
||||
real +
|
||||
recover +
|
||||
rune +
|
||||
string +
|
||||
true +
|
||||
uint +
|
||||
uint8 +
|
||||
uint16 +
|
||||
uint32 +
|
||||
uint64 +
|
||||
uintptr +
|
||||
true +
|
||||
false +
|
||||
iota +
|
||||
nil +
|
||||
cap +
|
||||
len +
|
||||
make +
|
||||
new +
|
||||
panic +
|
||||
print +
|
||||
println
|
||||
if n != 27*28/2 {
|
||||
fmt.Println("BUG: wrong n", n, 27*28/2)
|
||||
iota
|
||||
if n != NUM*(NUM-1)/2 {
|
||||
fmt.Println("BUG: wrong n", n, NUM*(NUM-1)/2)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
bool = 1
|
||||
byte = 2
|
||||
float = 3
|
||||
float32 = 4
|
||||
float64 = 5
|
||||
int = 6
|
||||
int8 = 7
|
||||
int16 = 8
|
||||
int32 = 9
|
||||
int64 = 10
|
||||
uint = 11
|
||||
uint8 = 12
|
||||
uint16 = 13
|
||||
uint32 = 14
|
||||
uint64 = 15
|
||||
uintptr = 16
|
||||
true = 17
|
||||
false = 18
|
||||
iota = 19
|
||||
nil = 20
|
||||
cap = 21
|
||||
len = 22
|
||||
make = 23
|
||||
new = 24
|
||||
panic = 25
|
||||
print = 26
|
||||
println = 27
|
||||
append = iota
|
||||
bool
|
||||
byte
|
||||
complex
|
||||
complex64
|
||||
complex128
|
||||
cap
|
||||
close
|
||||
delete
|
||||
error
|
||||
false
|
||||
float32
|
||||
float64
|
||||
imag
|
||||
int
|
||||
int8
|
||||
int16
|
||||
int32
|
||||
int64
|
||||
len
|
||||
make
|
||||
new
|
||||
nil
|
||||
panic
|
||||
print
|
||||
println
|
||||
real
|
||||
recover
|
||||
rune
|
||||
string
|
||||
true
|
||||
uint
|
||||
uint8
|
||||
uint16
|
||||
uint32
|
||||
uint64
|
||||
uintptr
|
||||
NUM
|
||||
iota = 0
|
||||
)
|
||||
|
@ -4,11 +4,14 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Verify that renamed identifiers no longer have their old meaning.
|
||||
// Does not compile.
|
||||
|
||||
package main
|
||||
|
||||
func main() {
|
||||
var n byte // ERROR "not a type|expected type"
|
||||
var y = float(0) // ERROR "cannot call|expected function"
|
||||
var y = float32(0) // ERROR "cannot call|expected function"
|
||||
const (
|
||||
a = 1 + iota // ERROR "string|incompatible types" "convert iota"
|
||||
)
|
||||
@ -16,31 +19,43 @@ func main() {
|
||||
}
|
||||
|
||||
const (
|
||||
bool = 1
|
||||
byte = 2
|
||||
float = 3
|
||||
float32 = 4
|
||||
float64 = 5
|
||||
int = 6
|
||||
int8 = 7
|
||||
int16 = 8
|
||||
int32 = 9
|
||||
int64 = 10
|
||||
uint = 11
|
||||
uint8 = 12
|
||||
uint16 = 13
|
||||
uint32 = 14
|
||||
uint64 = 15
|
||||
uintptr = 16
|
||||
true = 17
|
||||
false = 18
|
||||
iota = "abc"
|
||||
nil = 20
|
||||
cap = 21
|
||||
len = 22
|
||||
make = 23
|
||||
new = 24
|
||||
panic = 25
|
||||
print = 26
|
||||
println = 27
|
||||
append = iota
|
||||
bool
|
||||
byte
|
||||
complex
|
||||
complex64
|
||||
complex128
|
||||
cap
|
||||
close
|
||||
delete
|
||||
error
|
||||
false
|
||||
float32
|
||||
float64
|
||||
imag
|
||||
int
|
||||
int8
|
||||
int16
|
||||
int32
|
||||
int64
|
||||
len
|
||||
make
|
||||
new
|
||||
nil
|
||||
panic
|
||||
print
|
||||
println
|
||||
real
|
||||
recover
|
||||
rune
|
||||
string
|
||||
true
|
||||
uint
|
||||
uint8
|
||||
uint16
|
||||
uint32
|
||||
uint64
|
||||
uintptr
|
||||
NUM
|
||||
iota = "123"
|
||||
)
|
||||
|
@ -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 reordering of assignments.
|
||||
// Test reordering of assignments.
|
||||
|
||||
package main
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// derived from fixedbugs/bug294.go
|
||||
// Test reorderings; derived from fixedbugs/bug294.go.
|
||||
|
||||
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.
|
||||
|
||||
// Test rune constants, expressions and types.
|
||||
// Compiles but does not run.
|
||||
|
||||
package rune
|
||||
|
||||
var (
|
||||
|
@ -4,12 +4,13 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// make sure that even if a file imports runtime,
|
||||
// Test that even if a file imports runtime,
|
||||
// it cannot get at the low-level runtime definitions
|
||||
// known to the compiler. for normal packages
|
||||
// known to the compiler. For normal packages
|
||||
// the compiler doesn't even record the lower case
|
||||
// functions in its symbol table, but some functions
|
||||
// in runtime are hard-coded into the compiler.
|
||||
// Does not compile.
|
||||
|
||||
package main
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user