1// runoutput 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 source files and strings containing \r and \r\n. 8 9package main 10 11import ( 12 "fmt" 13 "strings" 14) 15 16func main() { 17 prog = strings.Replace(prog, "BQ", "`", -1) 18 prog = strings.Replace(prog, "CR", "\r", -1) 19 fmt.Print(prog) 20} 21 22var prog = ` 23package main 24CR 25 26import "fmt" 27 28var CR s = "hello\n" + CR 29 " world"CR 30 31var t = BQhelloCR 32 worldBQ 33 34var u = BQhCReCRlCRlCRoCR 35 worldBQ 36 37var golden = "hello\n world" 38 39func main() { 40 if s != golden { 41 fmt.Printf("s=%q, want %q", s, golden) 42 } 43 if t != golden { 44 fmt.Printf("t=%q, want %q", t, golden) 45 } 46 if u != golden { 47 fmt.Printf("u=%q, want %q", u, golden) 48 } 49} 50` 51