Add test coverage for nil pointers #41

Closed
opened 2025-12-28 18:12:16 +00:00 by sami · 1 comment
Owner

Originally created by @carpawell on GitHub (Apr 27, 2021).

Originally assigned to: @carpawell on GitHub.

There is a bugfix in #275 that adds checking zero pointers of one of the nested fields. Also, there is a fix of the corresponding unit test that allocates memory for empty struct by default. But it is done only for the certain struct.

Possible solutions:

  • Move all struct allocation for pointer fields behind if !empty statements in all generator functions.

  • Develop a general test constructor that fills all fields with correct non-nil values for one type of test cases and fills with incorrect nil pointer values for another(e.g. via reflect pkg).

Originally created by @carpawell on GitHub (Apr 27, 2021). Originally assigned to: @carpawell on GitHub. There is a bugfix in #275 that adds checking zero pointers of one of the nested fields. Also, there is a fix of the corresponding unit test that allocates memory for `empty` struct by default. But it is done only for the certain struct. ### Possible solutions: - [x] Move all struct allocation for pointer fields behind `if !empty` statements in all generator functions. - [ ] Develop a general test constructor that fills all fields with correct non-nil values for one type of test cases and fills with incorrect nil pointer values for another(e.g. via `reflect` pkg).
sami 2025-12-28 18:12:16 +00:00
Author
Owner

@carpawell commented on GitHub (Jun 11, 2021):

the second option is meaningless in our context(at least for now) since there are a lot of already written v2/*package*/test packages that contain more agile generators of required types

@carpawell commented on GitHub (Jun 11, 2021): the second option is meaningless in our context(at least for now) since there are a lot of already written `v2/*package*/test` packages that contain more agile generators of required types
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nspcc-dev/neofs-api-go#41
No description provided.