diff options
author | Doug Black <doug@dougblack.io> | 2014-03-29 23:07:54 -0700 |
---|---|---|
committer | Doug Black <doug@dougblack.io> | 2014-03-29 23:07:54 -0700 |
commit | 4f8269a8f4b5645b1896314787b5b2389939fa20 (patch) | |
tree | 0a4d01551282918300a186f51b5dd06dba9518b4 | |
parent | Merge pull request #13 from yuyabee/export_mux (diff) | |
parent | setup travis for continuous integration (diff) | |
download | sleepy-4f8269a8f4b5645b1896314787b5b2389939fa20.tar.gz sleepy-4f8269a8f4b5645b1896314787b5b2389939fa20.tar.bz2 sleepy-4f8269a8f4b5645b1896314787b5b2389939fa20.zip |
Merge pull request #16 from dmathieu/setup_ci
Setup continuous integrations
-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 ./... |