Merge pull request #442 from fkautz/pr_out_replacing_gopkg_in_check_v1_with_minio_io_check

This commit is contained in:
Frederick F. Kautz IV 2015-04-04 13:38:10 -07:00
commit 55a6d1797f
36 changed files with 140 additions and 139 deletions

8
Godeps/Godeps.json generated
View File

@ -13,6 +13,10 @@
"ImportPath": "github.com/gorilla/mux", "ImportPath": "github.com/gorilla/mux",
"Rev": "e444e69cbd2e2e3e0749a2f3c717cec491552bbf" "Rev": "e444e69cbd2e2e3e0749a2f3c717cec491552bbf"
}, },
{
"ImportPath": "github.com/minio-io/check",
"Rev": "bc4e66da8cd7ff58a4b9b84301f906352b8f2c94"
},
{ {
"ImportPath": "github.com/minio-io/cli", "ImportPath": "github.com/minio-io/cli",
"Comment": "1.2.0-100-g6d6f8d3", "Comment": "1.2.0-100-g6d6f8d3",
@ -37,10 +41,6 @@
{ {
"ImportPath": "github.com/stretchr/testify/mock", "ImportPath": "github.com/stretchr/testify/mock",
"Rev": "e4ec8152c15fc46bd5056ce65997a07c7d415325" "Rev": "e4ec8152c15fc46bd5056ce65997a07c7d415325"
},
{
"ImportPath": "gopkg.in/check.v1",
"Rev": "64131543e7896d5bcc6bd5a76287eb75ea96c673"
} }
] ]
} }

View File

@ -3,11 +3,11 @@ Instructions
Install the package with: Install the package with:
go get gopkg.in/check.v1 go get github.com/minio-io/check
Import it with: Import it with:
import "gopkg.in/check.v1" import "github.com/minio-io/check"
and use _check_ as the package name inside the code. and use _check_ as the package name inside the code.

View File

@ -3,8 +3,8 @@
package check_test package check_test
import ( import (
. "github.com/minio-io/check"
"time" "time"
. "gopkg.in/check.v1"
) )
var benchmarkS = Suite(&BenchmarkS{}) var benchmarkS = Suite(&BenchmarkS{})

View File

@ -14,7 +14,7 @@ package check_test
import ( import (
"fmt" "fmt"
"gopkg.in/check.v1" "github.com/minio-io/check"
"strings" "strings"
) )

View File

@ -12,7 +12,7 @@ import (
"testing" "testing"
"time" "time"
"gopkg.in/check.v1" "github.com/minio-io/check"
) )
// We count the number of suites run at least to get a vague hint that the // We count the number of suites run at least to get a vague hint that the

View File

@ -2,7 +2,7 @@ package check_test
import ( import (
"errors" "errors"
"gopkg.in/check.v1" "github.com/minio-io/check"
"reflect" "reflect"
"runtime" "runtime"
) )

View File

@ -3,7 +3,7 @@
package check_test package check_test
import ( import (
. "gopkg.in/check.v1" . "github.com/minio-io/check"
) )
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

View File

@ -8,7 +8,7 @@ package check_test
import ( import (
"fmt" "fmt"
"gopkg.in/check.v1" "github.com/minio-io/check"
"log" "log"
"os" "os"
"regexp" "regexp"

View File

@ -4,7 +4,7 @@
package check_test package check_test
import ( import (
"gopkg.in/check.v1" "github.com/minio-io/check"
"os" "os"
"reflect" "reflect"
"runtime" "runtime"

View File

@ -0,0 +1,110 @@
package check_test
import (
. "github.com/minio-io/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)
}
}

View File

@ -4,7 +4,7 @@ package check_test
import ( import (
"errors" "errors"
. "gopkg.in/check.v1" . "github.com/minio-io/check"
"os" "os"
"sync" "sync"
) )
@ -400,7 +400,7 @@ func (s *RunS) TestStreamModeWithMiss(c *C) {
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// Verify that that the keep work dir request indeed does so. // Verify that that the keep work dir request indeed does so.
type WorkDirSuite struct {} type WorkDirSuite struct{}
func (s *WorkDirSuite) Test(c *C) { func (s *WorkDirSuite) Test(c *C) {
c.MkDir() c.MkDir()
@ -411,7 +411,7 @@ func (s *RunS) TestKeepWorkDir(c *C) {
runConf := RunConf{Output: &output, Verbose: true, KeepWorkDir: true} runConf := RunConf{Output: &output, Verbose: true, KeepWorkDir: true}
result := Run(&WorkDirSuite{}, &runConf) 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) stat, err := os.Stat(result.WorkDir)
c.Assert(err, IsNil) c.Assert(err, IsNil)

View File

@ -1,104 +0,0 @@
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)
}
}

View File

@ -116,14 +116,9 @@ func (server *minioAPI) headObjectHandler(w http.ResponseWriter, req *http.Reque
{ {
writeErrorResponse(w, req, NoSuchKey, acceptsContentType, req.URL.Path) writeErrorResponse(w, req, NoSuchKey, acceptsContentType, req.URL.Path)
} }
case drivers.ImplementationError:
{
log.Error.Println(err)
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path)
}
default: default:
{ {
log.Error.Println(err) log.Error.Println(iodine.New(err, nil))
writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path) writeErrorResponse(w, req, InternalError, acceptsContentType, req.URL.Path)
} }
} }

View File

@ -40,7 +40,7 @@ import (
"github.com/minio-io/minio/pkg/drivers/mocks" "github.com/minio-io/minio/pkg/drivers/mocks"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
. "gopkg.in/check.v1" . "github.com/minio-io/check"
) )
func Test(t *testing.T) { TestingT(t) } func Test(t *testing.T) { TestingT(t) }

View File

@ -23,8 +23,8 @@ import (
"sync" "sync"
"testing" "testing"
. "github.com/minio-io/check"
"github.com/minio-io/minio/pkg/utils/crypto/keys" "github.com/minio-io/minio/pkg/utils/crypto/keys"
. "gopkg.in/check.v1"
) )
type MySuite struct{} type MySuite struct{}

View File

@ -21,7 +21,7 @@ import (
"math/rand" "math/rand"
"strconv" "strconv"
"gopkg.in/check.v1" "github.com/minio-io/check"
"time" "time"
) )

View File

@ -23,7 +23,7 @@ import (
"github.com/minio-io/minio/pkg/drivers" "github.com/minio-io/minio/pkg/drivers"
. "gopkg.in/check.v1" . "github.com/minio-io/check"
) )
func Test(t *testing.T) { TestingT(t) } func Test(t *testing.T) { TestingT(t) }

View File

@ -23,7 +23,7 @@ import (
"github.com/minio-io/minio/pkg/drivers" "github.com/minio-io/minio/pkg/drivers"
. "gopkg.in/check.v1" . "github.com/minio-io/check"
) )
func Test(t *testing.T) { TestingT(t) } func Test(t *testing.T) { TestingT(t) }

View File

@ -21,7 +21,7 @@ import (
"github.com/minio-io/minio/pkg/drivers" "github.com/minio-io/minio/pkg/drivers"
. "gopkg.in/check.v1" . "github.com/minio-io/check"
) )
func Test(t *testing.T) { TestingT(t) } func Test(t *testing.T) { TestingT(t) }

View File

@ -20,7 +20,7 @@ import (
"bytes" "bytes"
"testing" "testing"
. "gopkg.in/check.v1" . "github.com/minio-io/check"
) )
type MySuite struct{} type MySuite struct{}

View File

@ -19,7 +19,7 @@ package erasure
import ( import (
"bytes" "bytes"
. "gopkg.in/check.v1" . "github.com/minio-io/check"
) )
func corruptChunks(chunks [][]byte, errorIndex []int) [][]byte { func corruptChunks(chunks [][]byte, errorIndex []int) [][]byte {

View File

@ -8,7 +8,7 @@ import (
"testing" "testing"
"time" "time"
. "gopkg.in/check.v1" . "github.com/minio-io/check"
) )
func Test(t *testing.T) { TestingT(t) } func Test(t *testing.T) { TestingT(t) }

View File

@ -23,8 +23,8 @@ import (
"strings" "strings"
"testing" "testing"
. "github.com/minio-io/check"
"github.com/minio-io/minio/pkg/utils/cpu" "github.com/minio-io/minio/pkg/utils/cpu"
. "gopkg.in/check.v1"
) )
func Test(t *testing.T) { TestingT(t) } func Test(t *testing.T) { TestingT(t) }

View File

@ -19,8 +19,8 @@ package keys_test
import ( import (
"testing" "testing"
. "github.com/minio-io/check"
"github.com/minio-io/minio/pkg/utils/crypto/keys" "github.com/minio-io/minio/pkg/utils/crypto/keys"
. "gopkg.in/check.v1"
) )
func Test(t *testing.T) { TestingT(t) } func Test(t *testing.T) { TestingT(t) }

View File

@ -5,8 +5,8 @@ import (
"encoding/hex" "encoding/hex"
"testing" "testing"
. "github.com/minio-io/check"
"github.com/minio-io/minio/pkg/utils/crypto/md5" "github.com/minio-io/minio/pkg/utils/crypto/md5"
. "gopkg.in/check.v1"
) )
func Test(t *testing.T) { TestingT(t) } func Test(t *testing.T) { TestingT(t) }

View File

@ -24,8 +24,8 @@ import (
"strconv" "strconv"
"testing" "testing"
. "github.com/minio-io/check"
"github.com/minio-io/minio/pkg/utils/split" "github.com/minio-io/minio/pkg/utils/split"
. "gopkg.in/check.v1"
) )
type MySuite struct{} type MySuite struct{}