29 lines
574 B
Go
29 lines
574 B
Go
package token
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestTScope_ToString(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
input TScope
|
|
expected string
|
|
}{
|
|
{"Empty String", TScope(""), ""},
|
|
{"Simple String", TScope("read"), "read"},
|
|
{"Complex String", TScope("user:write"), "user:write"},
|
|
{"Special Characters", TScope("@dmin!"), "@dmin!"},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
// 使用指標調用方法
|
|
result := tt.input.ToString()
|
|
assert.Equal(t, tt.expected, result)
|
|
})
|
|
}
|
|
}
|