Further fixes -

- All test files have been renamed to their respective <package>_test name,
    this is done in accordance with
      - https://github.com/golang/go/wiki/CodeReviewComments#import-dot
        imports are largely used in testing, but to avoid namespace collision
        and circular dependencies

  - Never use _* in package names other than "_test" change fragment_v1 to expose
    fragment just like 'gopkg.in/check.v1'
This commit is contained in:
Harshavardhana
2015-03-06 01:50:51 -08:00
parent 02ccf123c9
commit e5af8a3f5d
24 changed files with 245 additions and 285 deletions

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package split
package split_test
import (
"bufio"
@@ -24,6 +24,7 @@ import (
"strconv"
"testing"
"github.com/minio-io/minio/pkg/utils/split"
. "gopkg.in/check.v1"
)
@@ -41,7 +42,7 @@ func (s *MySuite) TestSplitStream(c *C) {
}
bytesWriter.Flush()
reader := bytes.NewReader(bytesBuffer.Bytes())
ch := Stream(reader, 25)
ch := split.Stream(reader, 25)
var resultsBuffer bytes.Buffer
resultsWriter := bufio.NewWriter(&resultsBuffer)
for chunk := range ch {
@@ -52,17 +53,17 @@ func (s *MySuite) TestSplitStream(c *C) {
}
func (s *MySuite) TestFileSplitJoin(c *C) {
err := FileWithPrefix("test-data/TESTFILE", 1024, "TESTPREFIX")
err := split.FileWithPrefix("test-data/TESTFILE", 1024, "TESTPREFIX")
c.Assert(err, IsNil)
err = FileWithPrefix("test-data/TESTFILE", 1024, "")
err = split.FileWithPrefix("test-data/TESTFILE", 1024, "")
c.Assert(err, Not(IsNil))
devnull, err := os.OpenFile(os.DevNull, 2, os.ModeAppend)
defer devnull.Close()
reader := JoinFiles(".", "ERROR")
reader := split.JoinFiles(".", "ERROR")
_, err = io.Copy(devnull, reader)
c.Assert(err, Not(IsNil))
reader = JoinFiles(".", "TESTPREFIX")
reader = split.JoinFiles(".", "TESTPREFIX")
_, err = io.Copy(devnull, reader)
c.Assert(err, IsNil)
}