Skip to content

Commit

Permalink
refactor(test): Use path/filepath pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
yyoshiki41 committed Oct 24, 2017
1 parent 39bcfbe commit e7b41b4
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/base64"
"os"
"path"
"path/filepath"
"testing"
)

Expand Down Expand Up @@ -56,7 +56,7 @@ func TestAuth2Fms(t *testing.T) {
t.Error(err)
}

pngPath := path.Join(testdataDir, "authkey.png")
pngPath := filepath.Join(testdataDir, "authkey.png")
f, err := os.Open(pngPath)
if err != nil {
t.Error(err)
Expand Down
2 changes: 1 addition & 1 deletion client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func TestSetUserAgent(t *testing.T) {
const expected = "test-user-agent"
SetUserAgent(expected)
if expected != userAgent {
t.Errorf("expected %d, but %d", expected, userAgent)
t.Errorf("expected %s, but %s", expected, userAgent)
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/m3u8/m3u8_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package m3u8
import (
"bufio"
"os"
"path"
"path/filepath"
"testing"
)

Expand All @@ -14,7 +14,7 @@ func readTestData(fileName string) *os.File {
if GOPATH == "" {
panic("$GOPATH is empty.")
}
f, err := os.Open(path.Join(GOPATH, "src", testDir, fileName))
f, err := os.Open(filepath.Join(GOPATH, "src", testDir, fileName))
if err != nil {
panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions player_test.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package radiko

import (
"path"
"path/filepath"
"testing"
)

func TestDownloadPlayer(t *testing.T) {
dir, removeDir := createTestTempDir(t)
defer removeDir() // clean up

playerPath := path.Join(dir, "myplayer.swf")
playerPath := filepath.Join(dir, "myplayer.swf")
err := DownloadPlayer(playerPath)
if err != nil {
t.Errorf("Failed to download player.swf: %s", err)
Expand Down
4 changes: 2 additions & 2 deletions program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package radiko
import (
"context"
"os"
"path"
"path/filepath"
"testing"
"time"

Expand Down Expand Up @@ -109,7 +109,7 @@ func TestGetWeeklyPrograms(t *testing.T) {
}

func TestDecodeStationsData(t *testing.T) {
file, err := os.Open(path.Join(testdataDir, "stations.xml"))
file, err := os.Open(filepath.Join(testdataDir, "stations.xml"))
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io/ioutil"
"net/http"
"os"
"path"
"path/filepath"
"testing"
)

Expand All @@ -30,7 +30,7 @@ func init() {
if goPath == "" {
panic("$GOPATH is empty.")
}
testdataDir = path.Join(goPath, "src", "github.com/yyoshiki41/go-radiko", "testdata")
testdataDir = filepath.Join(goPath, "src", "github.com/yyoshiki41/go-radiko", "testdata")
}

// For skipping tests.
Expand Down

0 comments on commit e7b41b4

Please sign in to comment.