diff options
author | Milan Lenco <milan.lenco@pantheon.tech> | 2018-01-25 10:15:48 +0100 |
---|---|---|
committer | Milan Lenco <milan.lenco@pantheon.tech> | 2018-01-25 10:15:48 +0100 |
commit | 8ca20507d15703412c18b07d4f4ce6b4de989de6 (patch) | |
tree | aef60a5ef4dd150b62958b757e706f8c3311c68c /cmd/binapi-generator/generator_test.go | |
parent | 545eaea1c41c800794bb910a47de281e7e8df492 (diff) |
Update examples, tests and testdata after binapi-generator update.
Change-Id: I738d501cbbb6673010a32847df3f1c87050b8d36
Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
Diffstat (limited to 'cmd/binapi-generator/generator_test.go')
-rw-r--r-- | cmd/binapi-generator/generator_test.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/cmd/binapi-generator/generator_test.go b/cmd/binapi-generator/generator_test.go index a42e794..1fcbb66 100644 --- a/cmd/binapi-generator/generator_test.go +++ b/cmd/binapi-generator/generator_test.go @@ -120,7 +120,7 @@ func TestReadJson(t *testing.T) { result, err := parseJSON(inputData) Expect(err).ShouldNot(HaveOccurred()) Expect(result).ToNot(BeNil()) - Expect(result.Len()).To(BeEquivalentTo(3)) + Expect(result.Len()).To(BeEquivalentTo(5)) } func TestReadJsonError(t *testing.T) { @@ -255,8 +255,9 @@ func TestGenerateMessageFieldTypes(t *testing.T) { func TestGenerateMessageFieldMessages(t *testing.T) { // expected results according to acl.api.json in testdata - expectedTypes := []string{"\tMajor uint32", "\tMinor uint32", "\tACLIndex uint32", - "\tTag []byte `struc:\"[64]byte\"`", "\tACLIndex uint32", "\tRetval int32", "\tACLIndex uint32"} + expectedFields := []string{"\tMajor uint32", "\tMinor uint32", "\tRetval int32", + "\tVpePid uint32", "\tACLIndex uint32", "\tTag []byte `struc:\"[64]byte\"`", + "\tCount uint32"} RegisterTestingT(t) // prepare context testCtx := new(context) @@ -269,7 +270,7 @@ func TestGenerateMessageFieldMessages(t *testing.T) { Expect(err).ShouldNot(HaveOccurred()) Expect(inFile).ToNot(BeNil()) - // test types + // test message fields messages := inFile.Map("messages") customIndex := 0 fields := make([]string, 0) @@ -284,8 +285,12 @@ func TestGenerateMessageFieldMessages(t *testing.T) { } err := processMessageField(testCtx, &fields, field, false) Expect(err).ShouldNot(HaveOccurred()) - Expect(fields[customIndex]).To(BeEquivalentTo(expectedTypes[customIndex])) + Expect(fields[customIndex]).To(BeEquivalentTo(expectedFields[customIndex])) customIndex++ + if customIndex >= len(expectedFields) { + /* there is too much fields now for one UT... */ + return + } } } } |