OSDN Git Service

Update to current Go testsuite.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / go.test / test / crlf.go
1 // $G $D/$F.go && $L $F.$A && ./$A.out >tmp.go &&
2 // $G tmp.go && $L tmp.$A && ./$A.out
3 // rm -f tmp.go
4
5 // Copyright 2011 The Go Authors. All rights reserved.
6 // Use of this source code is governed by a BSD-style
7 // license that can be found in the LICENSE file.
8
9 // Test source files and strings containing \r and \r\n.
10
11 package main
12
13 import (
14         "fmt"
15         "strings"
16 )
17
18 func main() {
19         prog = strings.Replace(prog, "BQ", "`", -1)
20         prog = strings.Replace(prog, "CR", "\r", -1)
21         fmt.Print(prog)
22 }
23
24 var prog = `
25 package main
26 CR
27
28 import "fmt"
29
30 var CR s = "hello\n" + CR
31         " world"CR
32
33 var t = BQhelloCR
34  worldBQ
35
36 var u = BQhCReCRlCRlCRoCR
37  worldBQ
38
39 var golden = "hello\n world"
40
41 func main() {
42         if s != golden {
43                 fmt.Printf("s=%q, want %q", s, golden)
44         }
45         if t != golden {
46                 fmt.Printf("t=%q, want %q", t, golden)
47         }
48         if u != golden {
49                 fmt.Printf("u=%q, want %q", u, golden)
50         }
51 }
52 `