Skip to content

Commit

Permalink
run: rip out the List()/ListAll() methods, and the -check.l flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jhenstridge committed Aug 21, 2024
1 parent 9fee2a4 commit a198fb9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
39 changes: 0 additions & 39 deletions run.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package check

import (
"bufio"
"flag"
"fmt"
"os"
"testing"
)

Expand All @@ -24,25 +20,11 @@ func Suite(suite interface{}) interface{} {
// -----------------------------------------------------------------------
// Public running interface.

var (
oldListFlag = flag.Bool("gocheck.list", false, "List the names of all tests that will be run")

newListFlag = flag.Bool("check.list", false, "List the names of all tests that will be run")
)

// TestingT runs all test suites registered with the Suite function,
// printing results to stdout, and reporting any failures back to
// the "testing" package.
func TestingT(t *testing.T) {
t.Helper()
if *oldListFlag || *newListFlag {
w := bufio.NewWriter(os.Stdout)
for _, name := range ListAll() {
fmt.Fprintln(w, name)
}
w.Flush()
return
}
RunAll(t)
}

Expand All @@ -61,24 +43,3 @@ func Run(t *testing.T, suite interface{}) {
runner := newSuiteRunner(suite)
runner.run(t)
}

// ListAll returns the names of all the test functions registered with the
// Suite function that will be run with the provided run configuration.
func ListAll() []string {
var names []string
for _, suite := range allSuites {
names = append(names, List(suite)...)
}
return names
}

// List returns the names of the test functions in the given
// suite that will be run with the provided run configuration.
func List(suite interface{}) []string {
var names []string
runner := newSuiteRunner(suite)
for _, t := range runner.tests {
names = append(names, t.String())
}
return names
}
11 changes: 0 additions & 11 deletions run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,3 @@ func (s *RunS) TestFailOnSetUpSuite(c *C) {
c.Check(output.Status("FixtureHelper/Test1"), Equals, "")
c.Check(output.Status("FixtureHelper/Test2"), Equals, "")
}

// -----------------------------------------------------------------------
// Verify that List works correctly.

func (s *RunS) TestList(c *C) {
names := List(&FixtureHelper{})
c.Assert(names, DeepEquals, []string{
"FixtureHelper.Test1",
"FixtureHelper.Test2",
})
}

0 comments on commit a198fb9

Please sign in to comment.