28 lines
573 B
Go
28 lines
573 B
Go
|
package token
|
||
|
|
||
|
import (
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
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)
|
||
|
})
|
||
|
}
|
||
|
}
|