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

Side by Side Diff: src/pkg/testing/testing.go

Issue 5698080: code review 5698080: cmd/go: drop -example, apply -run to examples (Closed)
Patch Set: diff -r 7274b9ffeb86 https://code.google.com/p/go/ Created 13 years 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:
View unified diff | Download patch
« no previous file with comments | « src/pkg/testing/example.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 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 testing provides support for automated testing of Go packages. 5 // Package testing provides support for automated testing of Go packages.
6 // It is intended to be used in concert with the ``go test'' command, which auto mates 6 // It is intended to be used in concert with the ``go test'' command, which auto mates
7 // execution of any function of the form 7 // execution of any function of the form
8 // func TestXxx(*testing.T) 8 // func TestXxx(*testing.T)
9 // where Xxx can be any alphanumeric string (but the first letter must not be in 9 // where Xxx can be any alphanumeric string (but the first letter must not be in
10 // [a-z]) and serves to identify the test routine. 10 // [a-z]) and serves to identify the test routine.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 var ( 92 var (
93 // The short flag requests that tests run more quickly, but its function ality 93 // The short flag requests that tests run more quickly, but its function ality
94 // is provided by test writers themselves. The testing package is just its 94 // is provided by test writers themselves. The testing package is just its
95 // home. The all.bash installation script sets it to make installation more 95 // home. The all.bash installation script sets it to make installation more
96 // efficient, but by default the flag is off so a plain "go test" will d o a 96 // efficient, but by default the flag is off so a plain "go test" will d o a
97 // full test of the package. 97 // full test of the package.
98 short = flag.Bool("test.short", false, "run smaller test suite to save t ime") 98 short = flag.Bool("test.short", false, "run smaller test suite to save t ime")
99 99
100 // Report as tests are run; default is silent for success. 100 // Report as tests are run; default is silent for success.
101 chatty = flag.Bool("test.v", false, "verbose: print additional o utput") 101 chatty = flag.Bool("test.v", false, "verbose: print additional o utput")
102 » match = flag.String("test.run", "", "regular expression to sele ct tests to run") 102 » match = flag.String("test.run", "", "regular expression to sele ct tests and examples to run")
103 memProfile = flag.String("test.memprofile", "", "write a memory prof ile to the named file after execution") 103 memProfile = flag.String("test.memprofile", "", "write a memory prof ile to the named file after execution")
104 memProfileRate = flag.Int("test.memprofilerate", 0, "if >=0, sets runtim e.MemProfileRate") 104 memProfileRate = flag.Int("test.memprofilerate", 0, "if >=0, sets runtim e.MemProfileRate")
105 cpuProfile = flag.String("test.cpuprofile", "", "write a cpu profile to the named file during execution") 105 cpuProfile = flag.String("test.cpuprofile", "", "write a cpu profile to the named file during execution")
106 timeout = flag.Duration("test.timeout", 0, "if positive, sets an aggregate time limit for all tests") 106 timeout = flag.Duration("test.timeout", 0, "if positive, sets an aggregate time limit for all tests")
107 cpuListStr = flag.String("test.cpu", "", "comma-separated list of nu mber of CPUs to use for each test") 107 cpuListStr = flag.String("test.cpu", "", "comma-separated list of nu mber of CPUs to use for each test")
108 parallel = flag.Int("test.parallel", runtime.GOMAXPROCS(0), "maxim um test parallelism") 108 parallel = flag.Int("test.parallel", runtime.GOMAXPROCS(0), "maxim um test parallelism")
109 109
110 cpuList []int 110 cpuList []int
111 ) 111 )
112 112
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 for _, val := range strings.Split(*cpuListStr, ",") { 440 for _, val := range strings.Split(*cpuListStr, ",") {
441 cpu, err := strconv.Atoi(val) 441 cpu, err := strconv.Atoi(val)
442 if err != nil || cpu <= 0 { 442 if err != nil || cpu <= 0 {
443 fmt.Fprintf(os.Stderr, "testing: invalid value % q for -test.cpu", val) 443 fmt.Fprintf(os.Stderr, "testing: invalid value % q for -test.cpu", val)
444 os.Exit(1) 444 os.Exit(1)
445 } 445 }
446 cpuList = append(cpuList, cpu) 446 cpuList = append(cpuList, cpu)
447 } 447 }
448 } 448 }
449 } 449 }
OLDNEW
« no previous file with comments | « src/pkg/testing/example.go ('k') | no next file » | no next file with comments »

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