Migrate to upstream gopkg.in/check.v1

This commit is contained in:
Harshavardhana
2015-07-18 15:52:17 -07:00
parent 8790188473
commit f717e9b560
34 changed files with 133 additions and 139 deletions
+5 -5
View File
@@ -1,6 +1,6 @@
{
"ImportPath": "github.com/minio/mc",
"GoVersion": "go1.4",
"GoVersion": "go1.4.2",
"Packages": [
"./..."
],
@@ -17,10 +17,6 @@
"ImportPath": "github.com/fatih/structs",
"Rev": "c00d27128bb88e9c1adab1a53cda9c72c6d1ff9b"
},
{
"ImportPath": "github.com/minio/check",
"Rev": "67f8c16c6c27bb03c82e41c2be533ace00035ab4"
},
{
"ImportPath": "github.com/minio/cli",
"Comment": "1.2.0-112-g823349c",
@@ -47,6 +43,10 @@
{
"ImportPath": "github.com/shiena/ansicolor",
"Rev": "8368d3b31cf6f2c2464c7a91675342c9a0ac6658"
},
{
"ImportPath": "gopkg.in/check.v1",
"Rev": "64131543e7896d5bcc6bd5a76287eb75ea96c673"
}
]
}
-110
View File
@@ -1,110 +0,0 @@
package check_test
import (
. "github.com/minio/check"
)
var _ = Suite(&PrinterS{})
type PrinterS struct{}
func (s *PrinterS) TestCountSuite(c *C) {
suitesRun += 1
}
var printTestFuncLine int
func init() {
printTestFuncLine = getMyLine() + 3
}
func printTestFunc() {
println(1) // Comment1
if 2 == 2 { // Comment2
println(3) // Comment3
}
switch 5 {
case 6:
println(6) // Comment6
println(7)
}
switch interface{}(9).(type) { // Comment9
case int:
println(10)
println(11)
}
select {
case <-(chan bool)(nil):
println(14)
println(15)
default:
println(16)
println(17)
}
println(19,
20)
_ = func() {
println(21)
println(22)
}
println(24, func() {
println(25)
})
// Leading comment
// with multiple lines.
println(29) // Comment29
}
var printLineTests = []struct {
line int
output string
}{
{1, "println(1) // Comment1"},
{2, "if 2 == 2 { // Comment2\n ...\n}"},
{3, "println(3) // Comment3"},
{5, "switch 5 {\n...\n}"},
{6, "case 6:\n println(6) // Comment6\n ..."},
{7, "println(7)"},
{9, "switch interface{}(9).(type) { // Comment9\n...\n}"},
{10, "case int:\n println(10)\n ..."},
{14, "case <-(chan bool)(nil):\n println(14)\n ..."},
{15, "println(15)"},
{16, "default:\n println(16)\n ..."},
{17, "println(17)"},
{19, "println(19,\n 20)"},
{20, "println(19,\n 20)"},
{21, "_ = func() {\n println(21)\n println(22)\n}"},
{22, "println(22)"},
{24, "println(24, func() {\n println(25)\n})"},
{25, "println(25)"},
{26, "println(24, func() {\n println(25)\n})"},
{29, "// Leading comment\n// with multiple lines.\nprintln(29) // Comment29"},
}
// reformat broke test lines above
//func (s *PrinterS) TestPrintLine(c *C) {
// for _, test := range printLineTests {
// output, err := PrintLine("printer_test.go", printTestFuncLine+test.line)
// c.Assert(err, IsNil)
// c.Assert(output, Equals, test.output)
// }
//}
var indentTests = []struct {
in, out string
}{
{"", ""},
{"\n", "\n"},
{"a", ">>>a"},
{"a\n", ">>>a\n"},
{"a\nb", ">>>a\n>>>b"},
{" ", ">>> "},
}
func (s *PrinterS) TestIndent(c *C) {
for _, test := range indentTests {
out := Indent(test.in, ">>>")
c.Assert(out, Equals, test.out)
}
}
@@ -3,11 +3,11 @@ Instructions
Install the package with:
go get github.com/minio/check
go get gopkg.in/check.v1
Import it with:
import "github.com/minio/check"
import "gopkg.in/check.v1"
and use _check_ as the package name inside the code.
@@ -3,8 +3,8 @@
package check_test
import (
. "github.com/minio/check"
"time"
. "gopkg.in/check.v1"
)
var benchmarkS = Suite(&BenchmarkS{})
@@ -14,7 +14,7 @@ package check_test
import (
"fmt"
"github.com/minio/check"
"gopkg.in/check.v1"
"strings"
)
@@ -12,7 +12,7 @@ import (
"testing"
"time"
"github.com/minio/check"
"gopkg.in/check.v1"
)
// We count the number of suites run at least to get a vague hint that the
@@ -2,7 +2,7 @@ package check_test
import (
"errors"
"github.com/minio/check"
"gopkg.in/check.v1"
"reflect"
"runtime"
)
@@ -3,7 +3,7 @@
package check_test
import (
. "github.com/minio/check"
. "gopkg.in/check.v1"
)
// -----------------------------------------------------------------------
@@ -8,7 +8,7 @@ package check_test
import (
"fmt"
"github.com/minio/check"
"gopkg.in/check.v1"
"log"
"os"
"regexp"
@@ -4,7 +4,7 @@
package check_test
import (
"github.com/minio/check"
"gopkg.in/check.v1"
"os"
"reflect"
"runtime"
+104
View File
@@ -0,0 +1,104 @@
package check_test
import (
. "gopkg.in/check.v1"
)
var _ = Suite(&PrinterS{})
type PrinterS struct{}
func (s *PrinterS) TestCountSuite(c *C) {
suitesRun += 1
}
var printTestFuncLine int
func init() {
printTestFuncLine = getMyLine() + 3
}
func printTestFunc() {
println(1) // Comment1
if 2 == 2 { // Comment2
println(3) // Comment3
}
switch 5 {
case 6: println(6) // Comment6
println(7)
}
switch interface{}(9).(type) {// Comment9
case int: println(10)
println(11)
}
select {
case <-(chan bool)(nil): println(14)
println(15)
default: println(16)
println(17)
}
println(19,
20)
_ = func() { println(21)
println(22)
}
println(24, func() {
println(25)
})
// Leading comment
// with multiple lines.
println(29) // Comment29
}
var printLineTests = []struct {
line int
output string
}{
{1, "println(1) // Comment1"},
{2, "if 2 == 2 { // Comment2\n ...\n}"},
{3, "println(3) // Comment3"},
{5, "switch 5 {\n...\n}"},
{6, "case 6:\n println(6) // Comment6\n ..."},
{7, "println(7)"},
{9, "switch interface{}(9).(type) { // Comment9\n...\n}"},
{10, "case int:\n println(10)\n ..."},
{14, "case <-(chan bool)(nil):\n println(14)\n ..."},
{15, "println(15)"},
{16, "default:\n println(16)\n ..."},
{17, "println(17)"},
{19, "println(19,\n 20)"},
{20, "println(19,\n 20)"},
{21, "_ = func() {\n println(21)\n println(22)\n}"},
{22, "println(22)"},
{24, "println(24, func() {\n println(25)\n})"},
{25, "println(25)"},
{26, "println(24, func() {\n println(25)\n})"},
{29, "// Leading comment\n// with multiple lines.\nprintln(29) // Comment29"},
}
func (s *PrinterS) TestPrintLine(c *C) {
for _, test := range printLineTests {
output, err := PrintLine("printer_test.go", printTestFuncLine+test.line)
c.Assert(err, IsNil)
c.Assert(output, Equals, test.output)
}
}
var indentTests = []struct {
in, out string
}{
{"", ""},
{"\n", "\n"},
{"a", ">>>a"},
{"a\n", ">>>a\n"},
{"a\nb", ">>>a\n>>>b"},
{" ", ">>> "},
}
func (s *PrinterS) TestIndent(c *C) {
for _, test := range indentTests {
out := Indent(test.in, ">>>")
c.Assert(out, Equals, test.out)
}
}
@@ -4,7 +4,7 @@ package check_test
import (
"errors"
. "github.com/minio/check"
. "gopkg.in/check.v1"
"os"
"sync"
)
@@ -400,7 +400,7 @@ func (s *RunS) TestStreamModeWithMiss(c *C) {
// -----------------------------------------------------------------------
// Verify that that the keep work dir request indeed does so.
type WorkDirSuite struct{}
type WorkDirSuite struct {}
func (s *WorkDirSuite) Test(c *C) {
c.MkDir()
@@ -411,7 +411,7 @@ func (s *RunS) TestKeepWorkDir(c *C) {
runConf := RunConf{Output: &output, Verbose: true, KeepWorkDir: true}
result := Run(&WorkDirSuite{}, &runConf)
c.Assert(result.String(), Matches, ".*\nWORK="+result.WorkDir)
c.Assert(result.String(), Matches, ".*\nWORK=" + result.WorkDir)
stat, err := os.Stat(result.WorkDir)
c.Assert(err, IsNil)
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"os"
"path/filepath"
. "github.com/minio/check"
. "gopkg.in/check.v1"
)
func (s *CmdTestSuite) TestCatCmd(c *C) {
+1 -1
View File
@@ -99,7 +99,7 @@ func runListCmd(ctx *cli.Context) {
newTargetURL := stripRecursiveURL(targetURL)
err = doListCmd(newTargetURL, isURLRecursive(targetURL))
if err != nil {
console.Fatalln("Failed to list : %s. %s\n", targetURL, err)
console.Fatalf("Failed to list : %s. %s\n", targetURL, err)
}
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ import (
"net/http/httptest"
. "github.com/minio/check"
. "gopkg.in/check.v1"
"github.com/minio/mc/pkg/quick"
)
+1 -1
View File
@@ -23,7 +23,7 @@ import (
"path/filepath"
"strconv"
. "github.com/minio/check"
. "gopkg.in/check.v1"
)
func (s *CmdTestSuite) TestDiffObjects(c *C) {
+1 -1
View File
@@ -23,7 +23,7 @@ import (
"path/filepath"
"strconv"
. "github.com/minio/check"
. "gopkg.in/check.v1"
)
func (s *CmdTestSuite) TestLSCmd(c *C) {
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"os"
"path/filepath"
. "github.com/minio/check"
. "gopkg.in/check.v1"
)
func (s *CmdTestSuite) TestMbAndAccessCmd(c *C) {
+1 -1
View File
@@ -19,7 +19,7 @@ package client
import (
"testing"
. "github.com/minio/check"
. "gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
+1 -1
View File
@@ -24,7 +24,7 @@ import (
"path/filepath"
"testing"
. "github.com/minio/check"
. "gopkg.in/check.v1"
"github.com/minio/mc/pkg/client"
)
+1 -1
View File
@@ -26,7 +26,7 @@ import (
"testing"
"time"
. "github.com/minio/check"
. "gopkg.in/check.v1"
)
type bucketHandler struct {
+1 -1
View File
@@ -19,7 +19,7 @@ package console
import (
"testing"
. "github.com/minio/check"
. "gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"os"
"testing"
. "github.com/minio/check"
. "gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
+1 -1
View File
@@ -19,7 +19,7 @@ package main
import (
"regexp"
. "github.com/minio/check"
. "gopkg.in/check.v1"
)
func (s *CmdTestSuite) TestValidSessionID(c *C) {