Prepare to automated test.

This commit is contained in:
Naoki Kosaka 2018-11-08 00:57:15 +09:00
parent 3b4e33ece0
commit 934c7089f9
3 changed files with 56 additions and 0 deletions

21
.circleci/config.yml Normal file
View File

@ -0,0 +1,21 @@
version: 2
jobs:
test:
working_directory: /go/src/github.com/yukimochi/Activity-Relay
docker:
- image: circleci/golang
steps:
- checkout
- run:
name: build
command: |
go get -u github.com/golang/dep/cmd/dep
dep ensure
go test -coverprofile=coverage.txt . ./worker ./cli
bash <(curl -s https://codecov.io/bash)
workflows:
version: 2
build:
jobs:
- test

32
handle_test.go Normal file
View File

@ -0,0 +1,32 @@
package main
import "testing"
func TestContains(t *testing.T) {
data := "nil"
sData := []string{
"no",
"nil",
}
badData := 0
result := contains(data, "true")
if result != false {
t.Fatalf("Failed - no contain but true.")
}
result = contains(data, "nil")
if result != true {
t.Fatalf("Failed - contain but false.")
}
result = contains(sData, "true")
if result != false {
t.Fatalf("Failed - no contain but true. (slice)")
}
result = contains(sData, "nil")
if result != true {
t.Fatalf("Failed - contain but false. (slice)")
}
result = contains(badData, "hoge")
if result != false {
t.Fatalf("Failed - input bad data but true. (slice)")
}
}

View File

@ -2,6 +2,9 @@
## Yet another powerful customizable ActivityPub relay server written in Go.
[![CircleCI](https://circleci.com/gh/yukimochi/Activity-Relay.svg?style=svg)](https://circleci.com/gh/yukimochi/Activity-Relay)
[![codecov](https://codecov.io/gh/yukimochi/Activity-Relay/branch/master/graph/badge.svg)](https://codecov.io/gh/yukimochi/Activity-Relay)
![Powered by Ayame](docs/ayame.png)
## Packages