file_test.go 509 字节
package domain

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestFileName(t *testing.T) {
	inputs := []struct {
		input string
		want  string
	}{
		{
			input: "device/sdk/CMakeLists.txt",
			want:  "CMakeLists",
		},
		{
			input: "",
			want:  "",
		},
		{
			input: "CMakeLists.txt",
			want:  "CMakeLists",
		},
		{
			input: "d:\\CMakeLists.txt",
			want:  "CMakeLists",
		},
	}

	for _, input := range inputs {
		got := FileName(input.input)
		assert.Equal(t, input.want, got)
	}
}