Skip to content

Commit

Permalink
commands/files: Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mappum committed Jan 14, 2015
1 parent f8347f9 commit dbb5118
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions commands/files/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package files

import (
"io"
"io/ioutil"
"mime/multipart"
"strings"
"testing"
Expand All @@ -10,9 +11,9 @@ import (
func TestSliceFiles(t *testing.T) {
name := "testname"
files := []File{
&ReaderFile{"file.txt", strings.NewReader("Some text!\n")},
&ReaderFile{"beep.txt", strings.NewReader("beep")},
&ReaderFile{"boop.txt", strings.NewReader("boop")},
&ReaderFile{"file.txt", ioutil.NopCloser(strings.NewReader("Some text!\n"))},
&ReaderFile{"beep.txt", ioutil.NopCloser(strings.NewReader("beep"))},
&ReaderFile{"boop.txt", ioutil.NopCloser(strings.NewReader("boop"))},
}
buf := make([]byte, 20)

Expand Down Expand Up @@ -54,7 +55,7 @@ func TestSliceFiles(t *testing.T) {

func TestReaderFiles(t *testing.T) {
message := "beep boop"
rf := &ReaderFile{"file.txt", strings.NewReader(message)}
rf := &ReaderFile{"file.txt", ioutil.NopCloser(strings.NewReader(message))}
buf := make([]byte, len(message))

if rf.IsDirectory() {
Expand Down
9 changes: 5 additions & 4 deletions commands/http/multifilereader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package http

import (
"io"
"io/ioutil"
"mime/multipart"
"strings"
"testing"
Expand All @@ -12,12 +13,12 @@ import (
func TestOutput(t *testing.T) {
text := "Some text! :)"
fileset := []files.File{
&files.ReaderFile{"file.txt", strings.NewReader(text)},
&files.ReaderFile{"file.txt", ioutil.NopCloser(strings.NewReader(text))},
&files.SliceFile{"boop", []files.File{
&files.ReaderFile{"boop/a.txt", strings.NewReader("bleep")},
&files.ReaderFile{"boop/b.txt", strings.NewReader("bloop")},
&files.ReaderFile{"boop/a.txt", ioutil.NopCloser(strings.NewReader("bleep"))},
&files.ReaderFile{"boop/b.txt", ioutil.NopCloser(strings.NewReader("bloop"))},
}},
&files.ReaderFile{"beep.txt", strings.NewReader("beep")},
&files.ReaderFile{"beep.txt", ioutil.NopCloser(strings.NewReader("beep"))},
}
sf := &files.SliceFile{"", fileset}
buf := make([]byte, 20)
Expand Down

0 comments on commit dbb5118

Please sign in to comment.