-
Notifications
You must be signed in to change notification settings - Fork 3
/
ssh_config_test.go
48 lines (34 loc) · 699 Bytes
/
ssh_config_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package ssh_config
import (
"bytes"
"fmt"
"strings"
"testing"
)
var (
ssh_config_example = `# ssh config generated by some go code (github.com/jasonmoo/ssh_config)
# global configuration
VisualHostKey yes
# host-based configuration
# dev
Host dev
HostName 127.0.0.1
User ubuntu
Port 22
Host *.google.com *.yahoo.com
User root
`
)
func TestParseAndWriteTo(t *testing.T) {
config, err := Parse(strings.NewReader(ssh_config_example))
if err != nil {
t.Error(err)
}
buf := &bytes.Buffer{}
config.WriteTo(buf)
if buf.String() != ssh_config_example {
fmt.Println(ssh_config_example, "====")
fmt.Println(buf.String(), "====")
t.Errorf("input output mismatch")
}
}