OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [chan/] [sendstmt.go] - Blame information for rev 700

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 700 jeremybenn
// $G $D/$F.go && $L $F.$A && ./$A.out
2
 
3
// Copyright 2011 The Go Authors.  All rights reserved.
4
// Use of this source code is governed by a BSD-style
5
// license that can be found in the LICENSE file.
6
 
7
// Test various parsing cases that are a little
8
// different now that send is a statement, not a expression.
9
 
10
package main
11
 
12
func main() {
13
        chanchan()
14
        sendprec()
15
}
16
 
17
func chanchan() {
18
        cc := make(chan chan int, 1)
19
        c := make(chan int, 1)
20
        cc <- c
21
        select {
22
        case <-cc <- 2:
23
        default:
24
                panic("nonblock")
25
        }
26
        if <-c != 2 {
27
                panic("bad receive")
28
        }
29
}
30
 
31
func sendprec() {
32
        c := make(chan bool, 1)
33
        c <- false || true      // not a syntax error: same as c <- (false || true)
34
        if !<-c {
35
                panic("sent false")
36
        }
37
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.