about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@lumberjaph.net>2013-04-22 21:06:20 -0700
committerFranck Cuny <franck@lumberjaph.net>2013-04-22 21:06:20 -0700
commitcadbf10afaf95b3b96530a64962d535b83c27a71 (patch)
treeae1a9ee9bbd6cfa534b4e2607ff245f45c1394d4
parentRoutes inside the dispatcher private and check uniqueness of routes (diff)
downloadpath-router-cadbf10afaf95b3b96530a64962d535b83c27a71.tar.gz
Add a simple test for the dispatcher
-rw-r--r--dispatcher_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/dispatcher_test.go b/dispatcher_test.go
new file mode 100644
index 0000000..845833c
--- /dev/null
+++ b/dispatcher_test.go
@@ -0,0 +1,22 @@
+package mooh
+
+import (
+	"testing"
+)
+
+func testDispatcher (req *Request) (Response, error) {
+	resp := Response{}
+	return resp, nil
+}
+
+func testBasic(t *testing.T) {
+	d := BuildDispatcher()
+	err := d.AddRoute(&Route{Method:"GET", Path:"/", Code: testDispatcher})
+	if err != nil {
+		t.Fatal()
+	}
+	err = d.AddRoute(&Route{Method: "GET", Path:"/", Code: testDispatcher})
+	if err == nil {
+		t.Fatal()
+	}
+}