跳到主要内容

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

浏览文件

extensions_test.go

49 行 · 832 B历史下载
1package sshfx
2
3import (
4 "bytes"
5 "testing"
6)
7
8func TestExtensionPair(t *testing.T) {
9 const (
10 name = "foo"
11 data = "1"
12 )
13
14 pair := &ExtensionPair{
15 Name: name,
16 Data: data,
17 }
18
19 buf, err := pair.MarshalBinary()
20 if err != nil {
21 t.Fatal("unexpected error:", err)
22 }
23
24 want := []byte{
25 0x00, 0x00, 0x00, 3,
26 'f', 'o', 'o',
27 0x00, 0x00, 0x00, 1,
28 '1',
29 }
30
31 if !bytes.Equal(buf, want) {
32 t.Errorf("ExtensionPair.MarshalBinary() = %X, but wanted %X", buf, want)
33 }
34
35 *pair = ExtensionPair{}
36
37 if err := pair.UnmarshalBinary(buf); err != nil {
38 t.Fatal("unexpected error:", err)
39 }
40
41 if pair.Name != name {
42 t.Errorf("ExtensionPair.UnmarshalBinary(): Name was %q, but expected %q", pair.Name, name)
43 }
44
45 if pair.Data != data {
46 t.Errorf("RawPacket.UnmarshalBinary(): Data was %q, but expected %q", pair.Data, data)
47 }
48
49}