aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/items.go25
-rw-r--r--tests/one.go14
-rw-r--r--tests/test.go19
3 files changed, 11 insertions, 47 deletions
diff --git a/tests/items.go b/tests/items.go
deleted file mode 100644
index 6aae382..0000000
--- a/tests/items.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package main
-
-import (
- "net/url"
-
- "github.com/kid0m4n/sleepy"
-)
-
-type Item struct {
-}
-
-func (item Item) Get(values url.Values) (int, interface{}) {
- items := []string{"item1", "item2"}
- data := map[string][]string{"items": items}
-
- return 200, data
-}
-
-func main() {
- item := new(Item)
-
- var api = new(sleepy.Api)
- api.AddResource(item, "/items")
- api.Start(3000)
-}
diff --git a/tests/one.go b/tests/one.go
deleted file mode 100644
index 15fd27b..0000000
--- a/tests/one.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package main
-
-import (
- "net/http"
-)
-
-func response(rw http.ResponseWriter, request *http.Request) {
- rw.Write([]byte("Hello world."))
-}
-
-func main() {
- http.HandleFunc("/", response)
- http.ListenAndServe(":3000", nil)
-}
diff --git a/tests/test.go b/tests/test.go
index 8ccbfbd..b36cdb6 100644
--- a/tests/test.go
+++ b/tests/test.go
@@ -2,21 +2,24 @@ package main
import (
"net/url"
-
"github.com/dougblack/sleepy"
)
-type Bar struct {
-}
+type Item struct {}
+
+func (item Item) Get(values url.Values) (int, interface{}) {
+ items := []string{"item1", "item2"}
+ data := map[string][]string{"items": items}
-func (b Bar) Get(values url.Values) (int, interface{}) {
- return 200, map[string]string{"hello": "goodbye"}
+ return 200, data
}
func main() {
- bar := new(Bar)
- var api = new(sleepy.Api)
- api.AddResource(bar, "/bar")
+ item := new(Item)
+
+ var api = new(sleepy.API)
+ api.AddResource(item, "/items")
api.Start(3000)
+
}
bgstack15