summaryrefslogtreecommitdiff
path: root/internal/wireguard/ini
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-02-07 13:50:00 +0100
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-02-19 14:15:07 +0100
commit9cbe11f260ea9bede2ddc25c689e2761ae14039f (patch)
tree4db30293a1b3db20565c912a49e5ae685d63ed8e /internal/wireguard/ini
parentce52709e35bc92d12f3a94f6d0b521ef6ab69859 (diff)
Format: Run gofumpt
Diffstat (limited to 'internal/wireguard/ini')
-rw-r--r--internal/wireguard/ini/ini_test.go116
1 files changed, 58 insertions, 58 deletions
diff --git a/internal/wireguard/ini/ini_test.go b/internal/wireguard/ini/ini_test.go
index 5382878..5168dda 100644
--- a/internal/wireguard/ini/ini_test.go
+++ b/internal/wireguard/ini/ini_test.go
@@ -8,20 +8,20 @@ import (
)
func TestShouldSkip(t *testing.T) {
- cases := []struct{
- in string
+ cases := []struct {
+ in string
want bool
}{
{
- in: "test",
+ in: "test",
want: false,
},
{
- in: "#test",
+ in: "#test",
want: true,
},
{
- in: "",
+ in: "",
want: true,
},
}
@@ -35,25 +35,25 @@ func TestShouldSkip(t *testing.T) {
}
func TestIsSection(t *testing.T) {
- cases := []struct{
- in string
+ cases := []struct {
+ in string
want bool
}{
{
- in: "[test]",
+ in: "[test]",
want: true,
},
{
- in: "#test",
+ in: "#test",
want: false,
},
{
- in: "key=val",
+ in: "key=val",
want: false,
},
// sections with empty names will be ignored later
{
- in: "[]",
+ in: "[]",
want: true,
},
}
@@ -67,24 +67,24 @@ func TestIsSection(t *testing.T) {
}
func TestSectionName(t *testing.T) {
- cases := []struct{
- in string
+ cases := []struct {
+ in string
want string
}{
{
- in: "[test]",
+ in: "[test]",
want: "test",
},
{
- in: "[ spaces ]",
+ in: "[ spaces ]",
want: "spaces",
},
{
- in: "[]",
+ in: "[]",
want: "",
},
{
- in: "",
+ in: "",
want: "",
},
}
@@ -98,52 +98,52 @@ func TestSectionName(t *testing.T) {
}
func TestKeyValue(t *testing.T) {
- cases := []struct{
- in string
- wantk string
- wantv string
+ cases := []struct {
+ in string
+ wantk string
+ wantv string
wanterr string
}{
{
- in: "bla",
- wantk: "",
- wantv: "",
+ in: "bla",
+ wantk: "",
+ wantv: "",
wanterr: "no key/value found",
},
{
- in: "foo=bar",
- wantk: "foo",
- wantv: "bar",
+ in: "foo=bar",
+ wantk: "foo",
+ wantv: "bar",
wanterr: "",
},
{
- in: " foo = bar ",
- wantk: "foo",
- wantv: "bar",
+ in: " foo = bar ",
+ wantk: "foo",
+ wantv: "bar",
wanterr: "",
},
{
- in: "foo = bar",
- wantk: "foo",
- wantv: "bar",
+ in: "foo = bar",
+ wantk: "foo",
+ wantv: "bar",
wanterr: "",
},
{
- in: "",
- wantk: "",
- wantv: "",
+ in: "",
+ wantk: "",
+ wantv: "",
wanterr: "no key/value found",
},
{
- in: "=",
- wantk: "",
- wantv: "",
+ in: "=",
+ wantk: "",
+ wantv: "",
wanterr: "key cannot be empty",
},
{
- in: "empty=",
- wantk: "empty",
- wantv: "",
+ in: "empty=",
+ wantk: "empty",
+ wantv: "",
wanterr: "",
},
}
@@ -161,30 +161,30 @@ func TestKeyValue(t *testing.T) {
}
func TestOrderedKeysFind(t *testing.T) {
- cases := []struct{
- v OrderedKeys
+ cases := []struct {
+ v OrderedKeys
in string
- w int
+ w int
}{
{
- v: []string{""},
+ v: []string{""},
in: "test",
- w: -1,
+ w: -1,
},
{
- v: []string{"bla"},
+ v: []string{"bla"},
in: "bla",
- w: 0,
+ w: 0,
},
{
- v: []string{"ha"},
+ v: []string{"ha"},
in: "bla",
- w: -1,
+ w: -1,
},
{
- v: []string{"ha", "ga"},
+ v: []string{"ha", "ga"},
in: "ga",
- w: 1,
+ w: 1,
},
}
@@ -197,23 +197,23 @@ func TestOrderedKeysFind(t *testing.T) {
}
func TestOrderedKeysRemove(t *testing.T) {
- cases := []struct{
- v OrderedKeys
+ cases := []struct {
+ v OrderedKeys
rem string
out OrderedKeys
}{
{
- v: []string{"bla"},
+ v: []string{"bla"},
rem: "test",
out: []string{"bla"},
},
{
- v: []string{"bla"},
+ v: []string{"bla"},
rem: "bla",
out: []string{},
},
{
- v: []string{"ha", "ga"},
+ v: []string{"ha", "ga"},
rem: "ga",
out: []string{"ha"},
},