29 lines
699 B
Go
29 lines
699 B
Go
package main
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/suite"
|
|
"path"
|
|
"testing"
|
|
)
|
|
|
|
type BasenameTestSuite struct {
|
|
suite.Suite
|
|
}
|
|
|
|
func (suite *BasenameTestSuite) TestEmptySuffix() {
|
|
assert.Equal(suite.T(), "go-coreutils", basename(path.Join("tomo", "go-coreutils"), ""))
|
|
}
|
|
|
|
func (suite *BasenameTestSuite) TestSuffixNotInPath() {
|
|
assert.Equal(suite.T(), "go-coreutils", basename(path.Join("tomo", "go-coreutils"), ".git"))
|
|
}
|
|
|
|
func (suite *BasenameTestSuite) TestSuffixInPath() {
|
|
assert.Equal(suite.T(), "go-coreutils", basename(path.Join("tomo", "go-coreutils"), ".git"))
|
|
}
|
|
|
|
func TestBasenameTestSuite(t *testing.T) {
|
|
suite.Run(t, new(BasenameTestSuite))
|
|
}
|