diff options
author | Damien Mathieu <42@dmathieu.com> | 2014-02-03 13:37:17 +0100 |
---|---|---|
committer | Damien Mathieu <42@dmathieu.com> | 2014-02-03 13:37:17 +0100 |
commit | 574cbfde364ed091b0db8075be6e5f9058823bec (patch) | |
tree | 4307b00860c343efefca57a7f3a417606e550c78 | |
parent | remove tests.test (diff) | |
download | sleepy-574cbfde364ed091b0db8075be6e5f9058823bec.tar.gz sleepy-574cbfde364ed091b0db8075be6e5f9058823bec.tar.bz2 sleepy-574cbfde364ed091b0db8075be6e5f9058823bec.zip |
setup travis for continuous integration
-rw-r--r-- | .travis.yml | 7 | ||||
-rw-r--r-- | core_test.go (renamed from tests/sleepy_test.go) | 24 | ||||
-rwxr-xr-x | script/build | 4 | ||||
-rwxr-xr-x | script/test | 3 |
4 files changed, 26 insertions, 12 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..068fe6a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: go +go: + - 1.1.2 + - 1.2 +install: + - script/build +script: script/test diff --git a/tests/sleepy_test.go b/core_test.go index 655d0a6..196c52f 100644 --- a/tests/sleepy_test.go +++ b/core_test.go @@ -1,11 +1,11 @@ -package main +package sleepy import ( "github.com/dougblack/sleepy" + "io/ioutil" + "net/http" "net/url" - "net/http" - "testing" - "io/ioutil" + "testing" ) type Item struct{} @@ -23,12 +23,12 @@ func TestBasicGet(t *testing.T) { var api = sleepy.NewAPI() api.AddResource(item, "/items", "/bar", "/baz") go api.Start(3000) - resp, err := http.Get("http://localhost:3000/items") - if err != nil { - t.Error(err) - } - body, _ := ioutil.ReadAll(resp.Body) - if string(body) != `{"items":["item1","item2"]}` { - t.Error("Not equal.") - } + resp, err := http.Get("http://localhost:3000/items") + if err != nil { + t.Error(err) + } + body, _ := ioutil.ReadAll(resp.Body) + if string(body) != `{"items":["item1","item2"]}` { + t.Error("Not equal.") + } } diff --git a/script/build b/script/build new file mode 100755 index 0000000..980a1a2 --- /dev/null +++ b/script/build @@ -0,0 +1,4 @@ +#!/bin/bash + +go get -d -v ./... +go build -v ./... diff --git a/script/test b/script/test new file mode 100755 index 0000000..ff2d632 --- /dev/null +++ b/script/test @@ -0,0 +1,3 @@ +script/build +go fmt ./... +go test -v ./... |