modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/crlf.go (about) 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 9 package main 10 11 import ( 12 "fmt" 13 "strings" 14 ) 15 16 func main() { 17 prog = strings.Replace(prog, "BQ", "`", -1) 18 prog = strings.Replace(prog, "CR", "\r", -1) 19 fmt.Print(prog) 20 } 21 22 var prog = ` 23 package main 24 CR 25 26 import "fmt" 27 28 var CR s = "hello\n" + CR 29 " world"CR 30 31 var t = BQhelloCR 32 worldBQ 33 34 var u = BQhCReCRlCRlCRoCR 35 worldBQ 36 37 var golden = "hello\n world" 38 39 func 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 `