Skip to content

Commit

Permalink
test(dbushelpers): add test for VariantToValue function
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Dec 13, 2023
1 parent e4360c0 commit ce7982e
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions pkg/dbushelpers/dbus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,22 +735,27 @@ func TestGetSessionPath(t *testing.T) {
}
}

// func TestVariantToValue(t *testing.T) {
// type args struct {
// variant dbus.Variant
// }
// tests := []struct {
// name string
// args args
// want S
// }{
// // TODO: Add test cases.
// }
// for _, tt := range tests {
// t.Run(tt.name, func(t *testing.T) {
// if got := VariantToValue(tt.args.variant); !reflect.DeepEqual(got, tt.want) {
// t.Errorf("VariantToValue() = %v, want %v", got, tt.want)
// }
// })
// }
// }
func TestVariantToValue(t *testing.T) {
type args struct {
variant dbus.Variant
}
tests := []struct {
name string
args args
want string
}{
{
name: "string conversion",
args: args{variant: dbus.MakeVariant("foo")},
want: "foo",
},
// TODO: Test all possible variant values?
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := VariantToValue[string](tt.args.variant); !reflect.DeepEqual(got, tt.want) {
t.Errorf("VariantToValue() = %v, want %v", got, tt.want)
}
})
}
}

0 comments on commit ce7982e

Please sign in to comment.