gotesting.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>testing - The Go Programming Language</title>
  6. <link type="text/css" rel="stylesheet" href="/doc/style.css">
  7. <script type="text/javascript" src="/doc/godocs.js"></script>
  8. <link rel="search" type="application/opensearchdescription+xml" title="godoc" href="/opensearch.xml" />
  9. <script type="text/javascript">
  10. var _gaq = _gaq || [];
  11. _gaq.push(["_setAccount", "UA-11222381-2"]);
  12. _gaq.push(["_trackPageview"]);
  13. </script>
  14. </head>
  15. <body>
  16. <div id="topbar"><div class="container wide">
  17. <form method="GET" action="/search">
  18. <div id="menu">
  19. <a href="/doc/">Documents</a>
  20. <a href="/ref/">References</a>
  21. <a href="/pkg/">Packages</a>
  22. <a href="/project/">The Project</a>
  23. <a href="/help/">Help</a>
  24. <input type="text" id="search" name="q" class="inactive" value="Search">
  25. </div>
  26. <div id="heading"><a href="/">The Go Programming Language</a></div>
  27. </form>
  28. </div></div>
  29. <div id="page" class="wide">
  30. <div id="plusone"><g:plusone size="small" annotation="none"></g:plusone></div>
  31. <h1>Package testing</h1>
  32. <div id="nav"></div>
  33. <!--
  34. Copyright 2009 The Go Authors. All rights reserved.
  35. Use of this source code is governed by a BSD-style
  36. license that can be found in the LICENSE file.
  37. -->
  38. <div id="short-nav">
  39. <dl>
  40. <dd><code>import "testing"</code></dd>
  41. </dl>
  42. <dl>
  43. <dd><a href="#overview" class="overviewLink">Overview</a></dd>
  44. <dd><a href="#index">Index</a></dd>
  45. <dd><a href="#subdirectories">Subdirectories</a></dd>
  46. </dl>
  47. </div>
  48. <!-- The package's Name is printed as title by the top-level template -->
  49. <div id="overview" class="toggleVisible">
  50. <div class="collapsed">
  51. <h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
  52. </div>
  53. <div class="expanded">
  54. <h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
  55. <p>
  56. Package testing provides support for automated testing of Go packages.
  57. It is intended to be used in concert with the &ldquo;go test&rdquo; command, which automates
  58. execution of any function of the form
  59. </p>
  60. <pre>func TestXxx(*testing.T)
  61. </pre>
  62. <p>
  63. where Xxx can be any alphanumeric string (but the first letter must not be in
  64. [a-z]) and serves to identify the test routine.
  65. These TestXxx routines should be declared within the package they are testing.
  66. </p>
  67. <p>
  68. Functions of the form
  69. </p>
  70. <pre>func BenchmarkXxx(*testing.B)
  71. </pre>
  72. <p>
  73. are considered benchmarks, and are executed by the &#34;go test&#34; command when
  74. the -test.bench flag is provided.
  75. </p>
  76. <p>
  77. A sample benchmark function looks like this:
  78. </p>
  79. <pre>func BenchmarkHello(b *testing.B) {
  80. for i := 0; i &lt; b.N; i++ {
  81. fmt.Sprintf(&#34;hello&#34;)
  82. }
  83. }
  84. </pre>
  85. <p>
  86. The benchmark package will vary b.N until the benchmark function lasts
  87. long enough to be timed reliably. The output
  88. </p>
  89. <pre>testing.BenchmarkHello 10000000 282 ns/op
  90. </pre>
  91. <p>
  92. means that the loop ran 10000000 times at a speed of 282 ns per loop.
  93. </p>
  94. <p>
  95. If a benchmark needs some expensive setup before running, the timer
  96. may be stopped:
  97. </p>
  98. <pre>func BenchmarkBigLen(b *testing.B) {
  99. b.StopTimer()
  100. big := NewBig()
  101. b.StartTimer()
  102. for i := 0; i &lt; b.N; i++ {
  103. big.Len()
  104. }
  105. }
  106. </pre>
  107. <p>
  108. The package also runs and verifies example code. Example functions may
  109. include a concluding comment that begins with &#34;Output:&#34; and is compared with
  110. the standard output of the function when the tests are run, as in these
  111. examples of an example:
  112. </p>
  113. <pre>func ExampleHello() {
  114. fmt.Println(&#34;hello&#34;)
  115. // Output: hello
  116. }
  117. func ExampleSalutations() {
  118. fmt.Println(&#34;hello, and&#34;)
  119. fmt.Println(&#34;goodbye&#34;)
  120. // Output:
  121. // hello, and
  122. // goodbye
  123. }
  124. </pre>
  125. <p>
  126. Example functions without output comments are compiled but not executed.
  127. </p>
  128. <p>
  129. The naming convention to declare examples for a function F, a type T and
  130. method M on type T are:
  131. </p>
  132. <pre>func ExampleF() { ... }
  133. func ExampleT() { ... }
  134. func ExampleT_M() { ... }
  135. </pre>
  136. <p>
  137. Multiple example functions for a type/function/method may be provided by
  138. appending a distinct suffix to the name. The suffix must start with a
  139. lower-case letter.
  140. </p>
  141. <pre>func ExampleF_suffix() { ... }
  142. func ExampleT_suffix() { ... }
  143. func ExampleT_M_suffix() { ... }
  144. </pre>
  145. <p>
  146. The entire test file is presented as the example when it contains a single
  147. example function, at least one other function, type, variable, or constant
  148. declaration, and no test or benchmark functions.
  149. </p>
  150. </div>
  151. </div>
  152. <h2 id="index">Index</h2>
  153. <!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
  154. <div id="manual-nav">
  155. <dl>
  156. <dd><a href="#Main">func Main(matchString func(pat, str string) (bool, error), tests []InternalTest, benchmarks []InternalBenchmark, examples []InternalExample)</a></dd>
  157. <dd><a href="#RunBenchmarks">func RunBenchmarks(matchString func(pat, str string) (bool, error), benchmarks []InternalBenchmark)</a></dd>
  158. <dd><a href="#RunExamples">func RunExamples(matchString func(pat, str string) (bool, error), examples []InternalExample) (ok bool)</a></dd>
  159. <dd><a href="#RunTests">func RunTests(matchString func(pat, str string) (bool, error), tests []InternalTest) (ok bool)</a></dd>
  160. <dd><a href="#Short">func Short() bool</a></dd>
  161. <dd><a href="#B">type B</a></dd>
  162. <dd>&nbsp; &nbsp; <a href="#B.Error">func (c *B) Error(args ...interface{})</a></dd>
  163. <dd>&nbsp; &nbsp; <a href="#B.Errorf">func (c *B) Errorf(format string, args ...interface{})</a></dd>
  164. <dd>&nbsp; &nbsp; <a href="#B.Fail">func (c *B) Fail()</a></dd>
  165. <dd>&nbsp; &nbsp; <a href="#B.FailNow">func (c *B) FailNow()</a></dd>
  166. <dd>&nbsp; &nbsp; <a href="#B.Failed">func (c *B) Failed() bool</a></dd>
  167. <dd>&nbsp; &nbsp; <a href="#B.Fatal">func (c *B) Fatal(args ...interface{})</a></dd>
  168. <dd>&nbsp; &nbsp; <a href="#B.Fatalf">func (c *B) Fatalf(format string, args ...interface{})</a></dd>
  169. <dd>&nbsp; &nbsp; <a href="#B.Log">func (c *B) Log(args ...interface{})</a></dd>
  170. <dd>&nbsp; &nbsp; <a href="#B.Logf">func (c *B) Logf(format string, args ...interface{})</a></dd>
  171. <dd>&nbsp; &nbsp; <a href="#B.ResetTimer">func (b *B) ResetTimer()</a></dd>
  172. <dd>&nbsp; &nbsp; <a href="#B.SetBytes">func (b *B) SetBytes(n int64)</a></dd>
  173. <dd>&nbsp; &nbsp; <a href="#B.StartTimer">func (b *B) StartTimer()</a></dd>
  174. <dd>&nbsp; &nbsp; <a href="#B.StopTimer">func (b *B) StopTimer()</a></dd>
  175. <dd><a href="#BenchmarkResult">type BenchmarkResult</a></dd>
  176. <dd>&nbsp; &nbsp; <a href="#Benchmark">func Benchmark(f func(b *B)) BenchmarkResult</a></dd>
  177. <dd>&nbsp; &nbsp; <a href="#BenchmarkResult.NsPerOp">func (r BenchmarkResult) NsPerOp() int64</a></dd>
  178. <dd>&nbsp; &nbsp; <a href="#BenchmarkResult.String">func (r BenchmarkResult) String() string</a></dd>
  179. <dd><a href="#InternalBenchmark">type InternalBenchmark</a></dd>
  180. <dd><a href="#InternalExample">type InternalExample</a></dd>
  181. <dd><a href="#InternalTest">type InternalTest</a></dd>
  182. <dd><a href="#T">type T</a></dd>
  183. <dd>&nbsp; &nbsp; <a href="#T.Error">func (c *T) Error(args ...interface{})</a></dd>
  184. <dd>&nbsp; &nbsp; <a href="#T.Errorf">func (c *T) Errorf(format string, args ...interface{})</a></dd>
  185. <dd>&nbsp; &nbsp; <a href="#T.Fail">func (c *T) Fail()</a></dd>
  186. <dd>&nbsp; &nbsp; <a href="#T.FailNow">func (c *T) FailNow()</a></dd>
  187. <dd>&nbsp; &nbsp; <a href="#T.Failed">func (c *T) Failed() bool</a></dd>
  188. <dd>&nbsp; &nbsp; <a href="#T.Fatal">func (c *T) Fatal(args ...interface{})</a></dd>
  189. <dd>&nbsp; &nbsp; <a href="#T.Fatalf">func (c *T) Fatalf(format string, args ...interface{})</a></dd>
  190. <dd>&nbsp; &nbsp; <a href="#T.Log">func (c *T) Log(args ...interface{})</a></dd>
  191. <dd>&nbsp; &nbsp; <a href="#T.Logf">func (c *T) Logf(format string, args ...interface{})</a></dd>
  192. <dd>&nbsp; &nbsp; <a href="#T.Parallel">func (t *T) Parallel()</a></dd>
  193. </dl>
  194. <h4>Package files</h4>
  195. <p>
  196. <span style="font-size:90%">
  197. <a href="/src/pkg/testing/benchmark.go">benchmark.go</a>
  198. <a href="/src/pkg/testing/example.go">example.go</a>
  199. <a href="/src/pkg/testing/testing.go">testing.go</a>
  200. </span>
  201. </p>
  202. <h2 id="Main">func <a href="/src/pkg/testing/testing.go?s=9750:9890#L268">Main</a></h2>
  203. <pre>func Main(matchString func(pat, str string) (bool, error), tests []InternalTest, benchmarks []InternalBenchmark, examples []InternalExample)</pre>
  204. <p>
  205. An internal function but exported because it is cross-package; part of the implementation
  206. of the &#34;go test&#34; command.
  207. </p>
  208. <h2 id="RunBenchmarks">func <a href="/src/pkg/testing/benchmark.go?s=5365:5464#L207">RunBenchmarks</a></h2>
  209. <pre>func RunBenchmarks(matchString func(pat, str string) (bool, error), benchmarks []InternalBenchmark)</pre>
  210. <p>
  211. An internal function but exported because it is cross-package; part of the implementation
  212. of the &#34;go test&#34; command.
  213. </p>
  214. <h2 id="RunExamples">func <a href="/src/pkg/testing/example.go?s=314:417#L12">RunExamples</a></h2>
  215. <pre>func RunExamples(matchString func(pat, str string) (bool, error), examples []InternalExample) (ok bool)</pre>
  216. <h2 id="RunTests">func <a href="/src/pkg/testing/testing.go?s=10486:10580#L297">RunTests</a></h2>
  217. <pre>func RunTests(matchString func(pat, str string) (bool, error), tests []InternalTest) (ok bool)</pre>
  218. <h2 id="Short">func <a href="/src/pkg/testing/testing.go?s=4859:4876#L117">Short</a></h2>
  219. <pre>func Short() bool</pre>
  220. <p>
  221. Short reports whether the -test.short flag is set.
  222. </p>
  223. <h2 id="B">type <a href="/src/pkg/testing/benchmark.go?s=743:872#L17">B</a></h2>
  224. <pre>type B struct {
  225. N int
  226. <span class="comment">// contains filtered or unexported fields</span>
  227. }</pre>
  228. <p>
  229. B is a type passed to Benchmark functions to manage benchmark
  230. timing and to specify the number of iterations to run.
  231. </p>
  232. <h3 id="B.Error">func (*B) <a href="/src/pkg/testing/testing.go?s=8110:8153#L209">Error</a></h3>
  233. <pre>func (c *B) Error(args ...interface{})</pre>
  234. <p>
  235. Error is equivalent to Log() followed by Fail().
  236. </p>
  237. <h3 id="B.Errorf">func (*B) <a href="/src/pkg/testing/testing.go?s=8253:8312#L215">Errorf</a></h3>
  238. <pre>func (c *B) Errorf(format string, args ...interface{})</pre>
  239. <p>
  240. Errorf is equivalent to Logf() followed by Fail().
  241. </p>
  242. <h3 id="B.Fail">func (*B) <a href="/src/pkg/testing/testing.go?s=6270:6293#L163">Fail</a></h3>
  243. <pre>func (c *B) Fail()</pre>
  244. <p>
  245. Fail marks the function as having failed but continues execution.
  246. </p>
  247. <h3 id="B.FailNow">func (*B) <a href="/src/pkg/testing/testing.go?s=6548:6574#L170">FailNow</a></h3>
  248. <pre>func (c *B) FailNow()</pre>
  249. <p>
  250. FailNow marks the function as having failed and stops its execution.
  251. Execution will continue at the next test or benchmark.
  252. </p>
  253. <h3 id="B.Failed">func (*B) <a href="/src/pkg/testing/testing.go?s=6366:6396#L166">Failed</a></h3>
  254. <pre>func (c *B) Failed() bool</pre>
  255. <p>
  256. Failed returns whether the function has failed.
  257. </p>
  258. <h3 id="B.Fatal">func (*B) <a href="/src/pkg/testing/testing.go?s=8420:8463#L221">Fatal</a></h3>
  259. <pre>func (c *B) Fatal(args ...interface{})</pre>
  260. <p>
  261. Fatal is equivalent to Log() followed by FailNow().
  262. </p>
  263. <h3 id="B.Fatalf">func (*B) <a href="/src/pkg/testing/testing.go?s=8569:8628#L227">Fatalf</a></h3>
  264. <pre>func (c *B) Fatalf(format string, args ...interface{})</pre>
  265. <p>
  266. Fatalf is equivalent to Logf() followed by FailNow().
  267. </p>
  268. <h3 id="B.Log">func (*B) <a href="/src/pkg/testing/testing.go?s=7763:7804#L202">Log</a></h3>
  269. <pre>func (c *B) Log(args ...interface{})</pre>
  270. <p>
  271. Log formats its arguments using default formatting, analogous to Println(),
  272. and records the text in the error log.
  273. </p>
  274. <h3 id="B.Logf">func (*B) <a href="/src/pkg/testing/testing.go?s=7959:8016#L206">Logf</a></h3>
  275. <pre>func (c *B) Logf(format string, args ...interface{})</pre>
  276. <p>
  277. Logf formats its arguments according to the format, analogous to Printf(),
  278. and records the text in the error log.
  279. </p>
  280. <h3 id="B.ResetTimer">func (*B) <a href="/src/pkg/testing/benchmark.go?s=1503:1527#L48">ResetTimer</a></h3>
  281. <pre>func (b *B) ResetTimer()</pre>
  282. <p>
  283. ResetTimer sets the elapsed benchmark time to zero.
  284. It does not affect whether the timer is running.
  285. </p>
  286. <h3 id="B.SetBytes">func (*B) <a href="/src/pkg/testing/benchmark.go?s=1728:1757#L57">SetBytes</a></h3>
  287. <pre>func (b *B) SetBytes(n int64)</pre>
  288. <p>
  289. SetBytes records the number of bytes processed in a single operation.
  290. If this is called, the benchmark will report ns/op and MB/s.
  291. </p>
  292. <h3 id="B.StartTimer">func (*B) <a href="/src/pkg/testing/benchmark.go?s=1047:1071#L29">StartTimer</a></h3>
  293. <pre>func (b *B) StartTimer()</pre>
  294. <p>
  295. StartTimer starts timing a test. This function is called automatically
  296. before a benchmark starts, but it can also used to resume timing after
  297. a call to StopTimer.
  298. </p>
  299. <h3 id="B.StopTimer">func (*B) <a href="/src/pkg/testing/benchmark.go?s=1288:1311#L39">StopTimer</a></h3>
  300. <pre>func (b *B) StopTimer()</pre>
  301. <p>
  302. StopTimer stops timing a test. This can be used to pause the timer
  303. while performing complex initialization that you don&#39;t
  304. want to measure.
  305. </p>
  306. <h2 id="BenchmarkResult">type <a href="/src/pkg/testing/benchmark.go?s=4206:4391#L165">BenchmarkResult</a></h2>
  307. <pre>type BenchmarkResult struct {
  308. N int <span class="comment">// The number of iterations.</span>
  309. T time.Duration <span class="comment">// The total time taken.</span>
  310. Bytes int64 <span class="comment">// Bytes processed in one iteration.</span>
  311. }</pre>
  312. <p>
  313. The results of a benchmark run.
  314. </p>
  315. <h3 id="Benchmark">func <a href="/src/pkg/testing/benchmark.go?s=7545:7589#L275">Benchmark</a></h3>
  316. <pre>func Benchmark(f func(b *B)) BenchmarkResult</pre>
  317. <p>
  318. Benchmark benchmarks a single function. Useful for creating
  319. custom benchmarks that do not use the &#34;go test&#34; command.
  320. </p>
  321. <h3 id="BenchmarkResult.NsPerOp">func (BenchmarkResult) <a href="/src/pkg/testing/benchmark.go?s=4393:4433#L171">NsPerOp</a></h3>
  322. <pre>func (r BenchmarkResult) NsPerOp() int64</pre>
  323. <h3 id="BenchmarkResult.String">func (BenchmarkResult) <a href="/src/pkg/testing/benchmark.go?s=4677:4717#L185">String</a></h3>
  324. <pre>func (r BenchmarkResult) String() string</pre>
  325. <h2 id="InternalBenchmark">type <a href="/src/pkg/testing/benchmark.go?s=555:618#L10">InternalBenchmark</a></h2>
  326. <pre>type InternalBenchmark struct {
  327. Name string
  328. F func(b *B)
  329. }</pre>
  330. <p>
  331. An internal type but exported because it is cross-package; part of the implementation
  332. of the &#34;go test&#34; command.
  333. </p>
  334. <h2 id="InternalExample">type <a href="/src/pkg/testing/example.go?s=236:312#L6">InternalExample</a></h2>
  335. <pre>type InternalExample struct {
  336. Name string
  337. F func()
  338. Output string
  339. }</pre>
  340. <h2 id="InternalTest">type <a href="/src/pkg/testing/testing.go?s=9065:9121#L241">InternalTest</a></h2>
  341. <pre>type InternalTest struct {
  342. Name string
  343. F func(*T)
  344. }</pre>
  345. <p>
  346. An internal type but exported because it is cross-package; part of the implementation
  347. of the &#34;go test&#34; command.
  348. </p>
  349. <h2 id="T">type <a href="/src/pkg/testing/testing.go?s=6070:6199#L156">T</a></h2>
  350. <pre>type T struct {
  351. <span class="comment">// contains filtered or unexported fields</span>
  352. }</pre>
  353. <p>
  354. T is a type passed to Test functions to manage test state and support formatted test logs.
  355. Logs are accumulated during execution and dumped to standard error when done.
  356. </p>
  357. <h3 id="T.Error">func (*T) <a href="/src/pkg/testing/testing.go?s=8110:8153#L209">Error</a></h3>
  358. <pre>func (c *T) Error(args ...interface{})</pre>
  359. <p>
  360. Error is equivalent to Log() followed by Fail().
  361. </p>
  362. <h3 id="T.Errorf">func (*T) <a href="/src/pkg/testing/testing.go?s=8253:8312#L215">Errorf</a></h3>
  363. <pre>func (c *T) Errorf(format string, args ...interface{})</pre>
  364. <p>
  365. Errorf is equivalent to Logf() followed by Fail().
  366. </p>
  367. <h3 id="T.Fail">func (*T) <a href="/src/pkg/testing/testing.go?s=6270:6293#L163">Fail</a></h3>
  368. <pre>func (c *T) Fail()</pre>
  369. <p>
  370. Fail marks the function as having failed but continues execution.
  371. </p>
  372. <h3 id="T.FailNow">func (*T) <a href="/src/pkg/testing/testing.go?s=6548:6574#L170">FailNow</a></h3>
  373. <pre>func (c *T) FailNow()</pre>
  374. <p>
  375. FailNow marks the function as having failed and stops its execution.
  376. Execution will continue at the next test or benchmark.
  377. </p>
  378. <h3 id="T.Failed">func (*T) <a href="/src/pkg/testing/testing.go?s=6366:6396#L166">Failed</a></h3>
  379. <pre>func (c *T) Failed() bool</pre>
  380. <p>
  381. Failed returns whether the function has failed.
  382. </p>
  383. <h3 id="T.Fatal">func (*T) <a href="/src/pkg/testing/testing.go?s=8420:8463#L221">Fatal</a></h3>
  384. <pre>func (c *T) Fatal(args ...interface{})</pre>
  385. <p>
  386. Fatal is equivalent to Log() followed by FailNow().
  387. </p>
  388. <h3 id="T.Fatalf">func (*T) <a href="/src/pkg/testing/testing.go?s=8569:8628#L227">Fatalf</a></h3>
  389. <pre>func (c *T) Fatalf(format string, args ...interface{})</pre>
  390. <p>
  391. Fatalf is equivalent to Logf() followed by FailNow().
  392. </p>
  393. <h3 id="T.Log">func (*T) <a href="/src/pkg/testing/testing.go?s=7763:7804#L202">Log</a></h3>
  394. <pre>func (c *T) Log(args ...interface{})</pre>
  395. <p>
  396. Log formats its arguments using default formatting, analogous to Println(),
  397. and records the text in the error log.
  398. </p>
  399. <h3 id="T.Logf">func (*T) <a href="/src/pkg/testing/testing.go?s=7959:8016#L206">Logf</a></h3>
  400. <pre>func (c *T) Logf(format string, args ...interface{})</pre>
  401. <p>
  402. Logf formats its arguments according to the format, analogous to Printf(),
  403. and records the text in the error log.
  404. </p>
  405. <h3 id="T.Parallel">func (*T) <a href="/src/pkg/testing/testing.go?s=8809:8831#L234">Parallel</a></h3>
  406. <pre>func (t *T) Parallel()</pre>
  407. <p>
  408. Parallel signals that this test is to be run in parallel with (and only with)
  409. other parallel tests in this CPU group.
  410. </p>
  411. </div>
  412. <h2 id="subdirectories">Subdirectories</h2>
  413. <table class="dir">
  414. <tr>
  415. <th>Name</th>
  416. <th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
  417. <th style="text-align: left; width: auto">Synopsis</th>
  418. </tr>
  419. <tr>
  420. <td><a href="..">..</a></td>
  421. </tr>
  422. <tr>
  423. <td class="name"><a href="iotest">iotest</a></td>
  424. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  425. <td style="width: auto">Package iotest implements Readers and Writers useful mainly for testing.</td>
  426. </tr>
  427. <tr>
  428. <td class="name"><a href="quick">quick</a></td>
  429. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  430. <td style="width: auto">Package quick implements utility functions to help with black box testing.</td>
  431. </tr>
  432. </table>
  433. </div>
  434. <div id="footer">
  435. Build version go1.0.2.<br>
  436. Except as <a href="http://code.google.com/policies.html#restrictions">noted</a>,
  437. the content of this page is licensed under the
  438. Creative Commons Attribution 3.0 License,
  439. and code is licensed under a <a href="/LICENSE">BSD license</a>.<br>
  440. <a href="/doc/tos.html">Terms of Service</a> |
  441. <a href="http://www.google.com/intl/en/privacy/privacy-policy.html">Privacy Policy</a>
  442. </div>
  443. <script type="text/javascript">
  444. (function() {
  445. var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true;
  446. ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";
  447. var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);
  448. })();
  449. </script>
  450. </body>
  451. <script type="text/javascript">
  452. (function() {
  453. var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
  454. po.src = 'https://apis.google.com/js/plusone.js';
  455. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  456. })();
  457. </script>
  458. </html>