Commit 26a85211 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder Committed by Brad Fitzpatrick

test: gofmt chan/*.go

These are functional tests, so it is safe to gofmt them.

Change-Id: I3067279c1d49809ac6a62054448ab8a6c3de9bda
Reviewed-on: https://go-review.googlesource.com/43623Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent a9bf3b2e
......@@ -54,4 +54,3 @@ func main() {
AsynchFifo()
SynchFifo()
}
......@@ -28,19 +28,19 @@ func main() {
<-n // ERROR "receive from non-chan"
n <- 2 // ERROR "send to non-chan"
c <- 0 // ok
<-c // ok
x, ok := <-c // ok
c <- 0 // ok
<-c // ok
x, ok := <-c // ok
_, _ = x, ok
cr <- 0 // ERROR "send"
<-cr // ok
x, ok = <-cr // ok
cr <- 0 // ERROR "send"
<-cr // ok
x, ok = <-cr // ok
_, _ = x, ok
cs <- 0 // ok
<-cs // ERROR "receive"
x, ok = <-cs // ERROR "receive"
cs <- 0 // ok
<-cs // ERROR "receive"
x, ok = <-cs // ERROR "receive"
_, _ = x, ok
select {
......@@ -57,14 +57,14 @@ func main() {
_ = x
}
for _ = range cs {// ERROR "receive"
for _ = range cs { // ERROR "receive"
}
for range cs {// ERROR "receive"
for range cs { // ERROR "receive"
}
close(c)
close(cs)
close(cr) // ERROR "receive"
close(n) // ERROR "invalid operation.*non-chan type"
close(cr) // ERROR "receive"
close(n) // ERROR "invalid operation.*non-chan type"
}
This diff is collapsed.
This diff is collapsed.
......@@ -14,12 +14,10 @@ import "time"
const always = "function did not"
const never = "function did"
func unreachable() {
panic("control flow shouldn't reach here")
}
// Calls f and verifies that f always/never panics depending on signal.
func testPanic(signal string, f func()) {
defer func() {
......@@ -34,7 +32,6 @@ func testPanic(signal string, f func()) {
f()
}
// Calls f and empirically verifies that f always/never blocks depending on signal.
func testBlock(signal string, f func()) {
c := make(chan string)
......@@ -51,7 +48,6 @@ func testBlock(signal string, f func()) {
}
}
func main() {
const async = 1 // asynchronous channels
var nilch chan int
......@@ -114,8 +110,7 @@ func main() {
// empty selects always block
testBlock(always, func() {
select {
}
select {}
})
// selects with only nil channels always block
......
......@@ -30,7 +30,7 @@ func chanchan() {
func sendprec() {
c := make(chan bool, 1)
c <- false || true // not a syntax error: same as c <- (false || true)
c <- false || true // not a syntax error: same as c <- (false || true)
if !<-c {
panic("sent false")
}
......
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