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

commands/files: Fixed tests

parent 7bce6378
......@@ -2,6 +2,7 @@ package files
import (
"io"
"io/ioutil"
"mime/multipart"
"strings"
"testing"
......@@ -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)
......@@ -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() {
......
......@@ -2,6 +2,7 @@ package http
import (
"io"
"io/ioutil"
"mime/multipart"
"strings"
"testing"
......@@ -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)
......
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