Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
b2bf14ac
Commit
b2bf14ac
authored
Apr 05, 2011
by
Peter Mundy
Committed by
Rob Pike
Apr 05, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gotest: fixes for [^.]_test file pattern
R=rsc, r CC=golang-dev
https://golang.org/cl/4339054
parent
e6b1d424
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
doc.go
src/cmd/gotest/doc.go
+9
-7
gotest.go
src/cmd/gotest/gotest.go
+2
-2
No files found.
src/cmd/gotest/doc.go
View file @
b2bf14ac
...
...
@@ -7,12 +7,13 @@
Gotest is an automated testing tool for Go packages.
Normally a Go package is compiled without its test files. Gotest is a
tool that recompiles the package whose source in the current
directory, along with any files named *_test.go. Functions in the
test source named TestXXX (where XXX is any alphanumeric string not
starting with a lower case letter) will be run when the binary is
executed. Gotest requires that the package have a standard package
Makefile, one that includes go/src/Make.pkg.
tool that recompiles the package whose source is in the current
directory, along with any files whose names match the pattern
"[^.]*_test.go". Functions in the test source named TestXXX (where
XXX is any alphanumeric string not starting with a lower case letter)
will be run when the binary is executed. Gotest requires that the
package have a standard package Makefile, one that includes
go/src/Make.pkg.
The test functions are run in the order they appear in the source.
They should have the signature,
...
...
@@ -41,7 +42,8 @@ Usage:
The flags specific to gotest are:
-c Compile the test binary but do not run it.
-file a.go Use the tests in the source file a.go instead of *_test.go.
-file a.go Use only the tests in the source file a.go.
Multiple -file flags may be provided.
-x Print each subcommand gotest executes.
Everything else on the command line is passed to the test binary.
...
...
src/cmd/gotest/gotest.go
View file @
b2bf14ac
...
...
@@ -145,7 +145,7 @@ func setEnvironment() {
}
// getTestFileNames gets the set of files we're looking at.
// If gotest has no arguments, it scans
the current directory for *_test.go files
.
// If gotest has no arguments, it scans
for file names matching "[^.]*_test.go"
.
func
getTestFileNames
()
{
names
:=
fileNames
if
len
(
names
)
==
0
{
...
...
@@ -155,7 +155,7 @@ func getTestFileNames() {
Fatalf
(
"Glob pattern error: %s"
,
err
)
}
if
len
(
names
)
==
0
{
Fatalf
(
`no test files found: no match for "*_test.go"`
)
Fatalf
(
`no test files found: no match for "
[^.]
*_test.go"`
)
}
}
for
_
,
n
:=
range
names
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment