File: dbus_test.go

package info (click to toggle)
golang-dbus 5.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, experimental
  • size: 520 kB
  • sloc: sh: 41; makefile: 5
file content (24 lines) | stat: -rw-r--r-- 467 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package dbus

import (
	"testing"
)

type TestStruct struct {
	TestInt int
	TestStr string
}

func Test_VariantOfStruct(t *testing.T) {
	tester := TestStruct{TestInt: 123, TestStr: "foobar"}
	testerDecoded := []interface{}{123, "foobar"}
	variant := MakeVariant(testerDecoded)
	input := []interface{}{variant}
	var output TestStruct
	if err := Store(input, &output); err != nil {
		t.Fatal(err)
	}
	if tester != output {
		t.Fatalf("%v != %v\n", tester, output)
	}
}