Trim string slices upon loading config (fixes #1750)

This commit is contained in:
Audrius Butkevicius
2015-06-25 16:48:41 +01:00
parent 824fa8f17a
commit dae1d36a23
3 changed files with 32 additions and 1 deletions

View File

@@ -317,6 +317,29 @@ func TestIssue1262(t *testing.T) {
}
}
func TestIssue1750(t *testing.T) {
cfg, err := Load("testdata/issue-1750.xml", device4)
if err != nil {
t.Fatal(err)
}
if cfg.Options().ListenAddress[0] != ":23000" {
t.Errorf("%q != %q", cfg.Options().ListenAddress[0], ":23000")
}
if cfg.Options().ListenAddress[1] != ":23001" {
t.Errorf("%q != %q", cfg.Options().ListenAddress[1], ":23001")
}
if cfg.Options().GlobalAnnServers[0] != "udp4://syncthing.nym.se:22026" {
t.Errorf("%q != %q", cfg.Options().GlobalAnnServers[0], "udp4://syncthing.nym.se:22026")
}
if cfg.Options().GlobalAnnServers[1] != "udp4://syncthing.nym.se:22027" {
t.Errorf("%q != %q", cfg.Options().GlobalAnnServers[1], "udp4://syncthing.nym.se:22027")
}
}
func TestWindowsPaths(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("Not useful on non-Windows")