Merge lp:~allenap/gocheck/fail-when-left-over-arguments into lp:gocheck

Proposed by Gavin Panella
Status: Needs review
Proposed branch: lp:~allenap/gocheck/fail-when-left-over-arguments
Merge into: lp:gocheck
Diff against target: 23 lines (+6/-0)
1 file modified
run.go (+6/-0)
To merge this branch: bzr merge lp:~allenap/gocheck/fail-when-left-over-arguments
Reviewer Review Type Date Requested Status
Gustavo Niemeyer Pending
Review via email: mp+183029@code.launchpad.net

Description of the change

This attempts to help the situation where `go test -gocheck.v ./...` doesn't choke (the ./... is ignored), doesn't do what you expect it to (it tests the package in the current directory but not subdirectories), and is not obvious that it didn't do it (if there are tests in the current directory there will be output, but only careful attention will spot that tests in sub-packages have not been run).

I wasn't sure what the best way to report the error is, so it uses Fatalf().

To post a comment you must log in.

Unmerged revisions

86. By Gavin Panella

Fail if there are left-over arguments.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'run.go'
2--- run.go 2013-03-01 22:15:07 +0000
3+++ run.go 2013-08-29 21:12:28 +0000
4@@ -5,6 +5,7 @@
5 "flag"
6 "fmt"
7 "os"
8+ "strings"
9 "testing"
10 "time"
11 )
12@@ -38,6 +39,11 @@
13 // results to stdout, and reporting any failures back to the 'testing'
14 // module.
15 func TestingT(testingT *testing.T) {
16+ if flag.NArg() > 0 {
17+ testingT.Fatalf(
18+ "unrecognized extra arguments: %s",
19+ strings.Join(flag.Args(), " "))
20+ }
21 conf := &RunConf{
22 Filter: *filterFlag,
23 Verbose: *verboseFlag,

Subscribers

People subscribed via source and target branches