Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-cmds
Commits
81be5aee
Commit
81be5aee
authored
Jan 13, 2015
by
Matt Bell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands/files: Fixed tests
parent
7bce6378
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
files/file_test.go
files/file_test.go
+5
-4
http/multifilereader_test.go
http/multifilereader_test.go
+5
-4
No files found.
files/file_test.go
View file @
81be5aee
...
@@ -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
()
{
...
...
http/multifilereader_test.go
View file @
81be5aee
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment