-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathendpoint_test.go
34 lines (29 loc) · 876 Bytes
/
endpoint_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
// Copyright 2016 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package miniv
import (
"testing"
)
func TestEndpoint(t *testing.T) {
var tests = []struct {
in, h, p, err string
}{
{"@6@[email protected]:54879@@0c4fbc24ac9cf7c967620b9791b0b785@[email protected]:u:[email protected]:bridge@@", "192.168.0.107", "54879", ""},
// {"@6@wsh@[:]:54879@@0c4fbc24ac9cf7c967620b9791b0b785@[email protected]:u:[email protected]:bridge@@", "[:]", "54879", ""},
{"@6@wsh@", "", "", "Could not parse endpoint."},
}
for _, x := range tests {
h, p, err := nameParse(x.in)
if err != nil && err.Error() != x.err {
t.Error("unexpected error:", err)
continue
}
if h != x.h {
t.Errorf("h: want %v got %v", x.h, h)
}
if p != x.p {
t.Errorf("p: want %v got %v", x.p, p)
}
}
}