tailscale/net/dns/ini_test.go
Josh Bleecher Snyder a5da4ed981 all: gofmt with Go 1.17
This adds "//go:build" lines and tidies up existing "// +build" lines.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-08-05 15:54:00 -07:00

41 lines
917 B
Go

// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build windows
// +build windows
package dns
import (
"reflect"
"testing"
)
func TestParseIni(t *testing.T) {
var tests = []struct {
src string
want map[string]map[string]string
}{
{
src: `# appended wsl.conf file
[automount]
enabled = true
root=/mnt/
# added by tailscale
[network] # trailing comment
generateResolvConf = false # trailing comment`,
want: map[string]map[string]string{
"automount": map[string]string{"enabled": "true", "root": "/mnt/"},
"network": map[string]string{"generateResolvConf": "false"},
},
},
}
for _, test := range tests {
got := parseIni(test.src)
if !reflect.DeepEqual(got, test.want) {
t.Errorf("for:\n%s\ngot: %v\nwant: %v", test.src, got, test.want)
}
}
}