| // $G $D/$F.go && $L $F.$A && ./$A.out |
| // 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 range over channels |
| func gen(c chan int, lo, hi int) { |
| for i := lo; i <= hi; i++ { |
| func seq(lo, hi int) chan int { |
| for i := range seq('a', 'z') { |
| if s != "abcdefghijklmnopqrstuvwxyz" { |
| panicln("Wanted lowercase alphabet; got", s); |
| // test that range over array only evaluates |
| // the expression after "range" once. |
| for k, v := range makearray() { |
| panicln("range called makearray", nmake, "times"); |
| panicln("wrong sum ranging over makearray"); |