跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

typing_test.go

26 行 · 833 B历史下载
1package maclogin
2
3import "testing"
4
5func TestPasswordKeysKeepPrintableKeysSeparateFromSubmit(t *testing.T) {
6 keys, ok := passwordKeys("Aa7! _-\\\"[]{}")
7 if !ok || len(keys) != 13 {
8 t.Fatalf("password encoding failed: %v %d", ok, len(keys))
9 }
10 if keys[0] != (loginKey{0, true}) || keys[1] != (loginKey{0, false}) || keys[3] != (loginKey{18, true}) {
11 t.Fatal("shifted keys lost their physical code")
12 }
13 for _, key := range keys {
14 if key.code == 36 || key.code == 48 || key.code == 53 {
15 t.Fatal("password emitted a submit or navigation key")
16 }
17 }
18 for _, value := range []string{"password\nreturn", "password\x00", "密码password"} {
19 if _, ok := passwordKeys(value); ok {
20 t.Fatal("accepted control or unsupported character")
21 }
22 }
23 if _, ok := passwordKeys("short"); ok {
24 t.Fatal("accepted invalid length")
25 }
26}