Skip to content

Commit

Permalink
feat(testing): Remove flag parse
Browse files Browse the repository at this point in the history
  • Loading branch information
yyoshiki41 committed Jan 18, 2018
1 parent fe6f7f9 commit 8982bf4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ test:
go test $(PKGS)

test-out:
go test -outjp $(PKGS)
GO_RADIKO_OUTSIDE_JP=true go test $(PKGS)

test-ci:
@echo "go test -outjp"
@go test -outjp -race -coverprofile=coverage.txt -covermode=atomic $(PKGS)
@echo "GO_RADIKO_OUTSIDE_JP=true go test"
@GO_RADIKO_OUTSIDE_JP=true go test -outjp -race -coverprofile=coverage.txt -covermode=atomic $(PKGS)

verify: lint vet

Expand Down
14 changes: 6 additions & 8 deletions testing.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package radiko

import (
"flag"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"testing"
)

const (
areaIDTokyo = "JP13"
)
const areaIDTokyo = "JP13"

var (
outsideJP bool
Expand All @@ -20,10 +17,11 @@ var (
)

func init() {
// FIXME:
// affects the outside packages
flag.BoolVar(&outsideJP, "outjp", false, "Skip tests if outside Japan.")
flag.Parse()
// Skip tests if outside Japan.
OUTSIDEJP := os.Getenv("GO_RADIKO_OUTSIDE_JP")
if len(OUTSIDEJP) > 0 {
outsideJP = true
}

GOPATH := os.Getenv("GOPATH")
testdataDir = filepath.Join(GOPATH, "src", "github.com/yyoshiki41/go-radiko", "testdata")
Expand Down

0 comments on commit 8982bf4

Please sign in to comment.