2025-02-26 08:45:27 +00:00
|
|
|
package token
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2025-02-26 15:29:00 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2025-02-26 08:45:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|