Commit 81be5aee authored by Matt Bell's avatar Matt Bell

commands/files: Fixed tests

parent 7bce6378
...@@ -2,6 +2,7 @@ package files ...@@ -2,6 +2,7 @@ package files
import ( import (
"io" "io"
"io/ioutil"
"mime/multipart" "mime/multipart"
"strings" "strings"
"testing" "testing"
...@@ -10,9 +11,9 @@ import ( ...@@ -10,9 +11,9 @@ import (
func TestSliceFiles(t *testing.T) { func TestSliceFiles(t *testing.T) {
name := "testname" name := "testname"
files := []File{ files := []File{
&ReaderFile{"file.txt", strings.NewReader("Some text!\n")}, &ReaderFile{"file.txt", ioutil.NopCloser(strings.NewReader("Some text!\n"))},
&ReaderFile{"beep.txt", strings.NewReader("beep")}, &ReaderFile{"beep.txt", ioutil.NopCloser(strings.NewReader("beep"))},
&ReaderFile{"boop.txt", strings.NewReader("boop")}, &ReaderFile{"boop.txt", ioutil.NopCloser(strings.NewReader("boop"))},
} }
buf := make([]byte, 20) buf := make([]byte, 20)
...@@ -54,7 +55,7 @@ func TestSliceFiles(t *testing.T) { ...@@ -54,7 +55,7 @@ func TestSliceFiles(t *testing.T) {
func TestReaderFiles(t *testing.T) { func TestReaderFiles(t *testing.T) {
message := "beep boop" message := "beep boop"
rf := &ReaderFile{"file.txt", strings.NewReader(message)} rf := &ReaderFile{"file.txt", ioutil.NopCloser(strings.NewReader(message))}
buf := make([]byte, len(message)) buf := make([]byte, len(message))
if rf.IsDirectory() { if rf.IsDirectory() {
......
...@@ -2,6 +2,7 @@ package http ...@@ -2,6 +2,7 @@ package http
import ( import (
"io" "io"
"io/ioutil"
"mime/multipart" "mime/multipart"
"strings" "strings"
"testing" "testing"
...@@ -12,12 +13,12 @@ import ( ...@@ -12,12 +13,12 @@ import (
func TestOutput(t *testing.T) { func TestOutput(t *testing.T) {
text := "Some text! :)" text := "Some text! :)"
fileset := []files.File{ 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.SliceFile{"boop", []files.File{
&files.ReaderFile{"boop/a.txt", strings.NewReader("bleep")}, &files.ReaderFile{"boop/a.txt", ioutil.NopCloser(strings.NewReader("bleep"))},
&files.ReaderFile{"boop/b.txt", strings.NewReader("bloop")}, &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} sf := &files.SliceFile{"", fileset}
buf := make([]byte, 20) buf := make([]byte, 20)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment