Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
bughou committed Nov 8, 2021
1 parent 6dd5804 commit e0c037a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/go.yml
Expand Up @@ -38,11 +38,16 @@ jobs:
run: go build -v ./...

- name: Test
run: go test -v ./...
if: ${{ ! (matrix.os == 'ubuntu-latest' && matrix.go == '1.16') }}

- name: Test with coverage
run: go test -v -coverprofile=profile.cov ./...
if: ${{ matrix.os == 'ubuntu-latest' && matrix.go == '1.16' }}

- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
if: ${{ matrix.go == '1.16' }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.go == '1.16' }}

2 changes: 1 addition & 1 deletion Readme.md
Expand Up @@ -4,7 +4,7 @@ file system relevant utils.
[![Build Status](https://github.com/lovego/fs/actions/workflows/go.yml/badge.svg)](https://github.com/lovego/fs/actions/workflows/go.yml)
[![Coverage Status](https://coveralls.io/repos/github/lovego/fs/badge.svg?branch=master)](https://coveralls.io/github/lovego/fs)
[![Go Report Card](https://goreportcard.com/badge/github.com/lovego/fs)](https://goreportcard.com/report/github.com/lovego/fs)
[![Documentation](https://pkg.go.dev/badge/github.com/lovego/fs)](https://pkg.go.dev/github.com/lovego/fs@v0.0.2)
[![Documentation](https://pkg.go.dev/badge/github.com/lovego/fs)](https://pkg.go.dev/github.com/lovego/fs@v0.0.4)

## Install
`$ go get github.com/lovego/fs`
Expand Down
12 changes: 12 additions & 0 deletions path_linux_test.go
@@ -0,0 +1,12 @@
package fs

import (
"fmt"
"path/filepath"
)

func ExampleFilepathDir_linux() {
fmt.Println(filepath.Dir(`/`))
// Output:
// /
}
12 changes: 2 additions & 10 deletions path_test.go
Expand Up @@ -8,20 +8,12 @@ import (

func ExampleSourceDir() {
p := SourceDir()
fmt.Println(p)
fmt.Println(strings.HasSuffix(filepath.ToSlash(p), `github.com/lovego/fs`))
fmt.Println(strings.HasSuffix(filepath.ToSlash(p), `/fs`))
// Output: true
}

func ExampleSourceFile() {
p := SourceFile()
fmt.Println(p)
fmt.Println(strings.HasSuffix(filepath.ToSlash(p), `github.com/lovego/fs/path_test.go`))
fmt.Println(strings.HasSuffix(filepath.ToSlash(p), `/fs/path_test.go`))
// Output: true
}

func ExampleFilepathDir() {
fmt.Println(filepath.Dir(`/`))
// Output:
// /
}
4 changes: 2 additions & 2 deletions path_windows_test.go
Expand Up @@ -5,8 +5,8 @@ import (
"path/filepath"
)

func ExampleFilepathDir() {
func ExampleFilepathDir_windows() {
fmt.Println(filepath.Dir(`C:\`))
// Output:
// C:\\
// C:\
}

0 comments on commit e0c037a

Please sign in to comment.