Skip to content

Conformance test suite#44

Merged
lchenut merged 31 commits intomasterfrom
conformance-tests
Feb 21, 2023
Merged

Conformance test suite#44
lchenut merged 31 commits intomasterfrom
conformance-tests

Conversation

@lchenut
Copy link
Copy Markdown
Contributor

@lchenut lchenut commented Feb 13, 2023

Using the conformance_test_runner from https://github.com/protocolbuffers/protobuf
This PR adds several things in order to make the test executable, such as

Currently, there's a lot of tests that fail mainly because of #40 which has not been merged yet (writing all-defaults proto3 object fields creates a lot of error, for example)

@lchenut lchenut marked this pull request as ready for review February 15, 2023 10:19
Copy link
Copy Markdown
Collaborator

@Menduist Menduist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's finish enums in #43

@lchenut lchenut merged commit 43f7730 into master Feb 21, 2023
@lchenut lchenut deleted the conformance-tests branch February 21, 2023 11:06
else:
static: doAssert ProtoType is SomeFixed64
ProtoType.SomeFixed64
WireKind.Fixed64
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the assert here should remain

stream.readFieldPackedInto(fieldVar, header, ProtoType)
else:
stream.readFieldInto(fieldVar, header, ProtoType)
elif ProtoType is ref and defined(ConformanceTest):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does the conformance test need this? there are no ref semantics in protobuf afair

Copy link
Copy Markdown
Contributor Author

@lchenut lchenut Feb 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because some tests are recursive (using this message for example). And without using a reference, nim loops, until it crashes, trying to compile it. A (better?) alternative could be to use a PBOption in case of recursive messages.

Copy link
Copy Markdown
Collaborator

@Menduist Menduist Feb 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't work:

import stew/results
type
  A = object
    b: Opt[B]

  B = object
    a: Opt[A]
test.nim(3, 3) Error: illegal recursion in type 'A'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants