Added tests for all plugins

This commit is contained in:
Leonid Bugaev
2013-10-29 11:42:15 +01:00
parent 9dddab58d3
commit ce76453fa6
11 changed files with 323 additions and 16 deletions
+31
View File
@@ -0,0 +1,31 @@
package gor
type TestInput struct {
data chan []byte
}
func NewTestInput() (i *TestInput) {
i = new(TestInput)
i.data = make(chan []byte)
return
}
func (i *TestInput) Read(data []byte) (int, error) {
buf := <-i.data
copy(data, buf)
return len(buf), nil
}
func (i *TestInput) EmitGET() {
i.data <- []byte("GET / HTTP/1.1\r\n\r\n")
}
func (i *TestInput) EmitPOST() {
i.data <- []byte("POST /pub/WWW/ HTTP/1.1\nHost: www.w3.org\r\n\r\na=1&b=2\r\n\r\n")
}
func (i *TestInput) String() string {
return "Test Input"
}