Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3631)

Delta Between Two Patch Sets: src/cmd/gotest/gotest.go

Issue 4357052: code review 4357052: os: New Open API. (Closed)
Left Patch Set: Created 12 years, 12 months ago
Right Patch Set: diff -r dc1d5042801a https://go.googlecode.com/hg/ Created 12 years, 12 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package main 5 package main
6 6
7 import ( 7 import (
8 "bufio" 8 "bufio"
9 "exec" 9 "exec"
10 "fmt" 10 "fmt"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 if err != nil { 306 if err != nil {
307 Fatalf("can't read output from command: %s", err) 307 Fatalf("can't read output from command: %s", err)
308 } 308 }
309 return string(b) 309 return string(b)
310 } 310 }
311 return "" 311 return ""
312 } 312 }
313 313
314 // writeTestmainGo generates the test program to be compiled, "./_testmain.go". 314 // writeTestmainGo generates the test program to be compiled, "./_testmain.go".
315 func writeTestmainGo() { 315 func writeTestmainGo() {
316 » f, err := os.OpenFile("_testmain.go", os.O_WRONLY|os.O_CREATE|os.O_TRUNC , 0666) 316 » f, err := os.Create("_testmain.go")
317 if err != nil { 317 if err != nil {
318 Fatalf("can't create _testmain.go: %s", err) 318 Fatalf("can't create _testmain.go: %s", err)
319 } 319 }
320 defer f.Close() 320 defer f.Close()
321 b := bufio.NewWriter(f) 321 b := bufio.NewWriter(f)
322 defer b.Flush() 322 defer b.Flush()
323 323
324 // Package and imports. 324 // Package and imports.
325 fmt.Fprint(b, "package main\n\n") 325 fmt.Fprint(b, "package main\n\n")
326 // Are there tests from a package other than the one we're testing? 326 // Are there tests from a package other than the one we're testing?
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 if err != nil { 403 if err != nil {
404 return 404 return
405 } 405 }
406 } 406 }
407 return matchRe.MatchString(str), nil 407 return matchRe.MatchString(str), nil
408 } 408 }
409 409
410 func main() { 410 func main() {
411 testing.Main(matchString, tests, benchmarks) 411 testing.Main(matchString, tests, benchmarks)
412 }` 412 }`
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b