Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: assert.Subset for maps #1330

Closed
wants to merge 0 commits into from
Closed

Fix: assert.Subset for maps #1330

wants to merge 0 commits into from

Conversation

Agurato
Copy link

@Agurato Agurato commented Jan 27, 2023

Summary

This PR aims to fix the assert.Subset (and assert.NotSubset) functions for maps

Changes

  • Updated the NotSubset(…) function to check the key's existence in the containing map. Before the fix, if the key did not exist in the containing map, a panic would occur and the function would return false.

  • Updated the Subset(…) function to do the same and avoid a panic. This panic was well intercepted and the test returned the correct result, but I figured that this was a better way.

Motivation

I noticed that the NotSubset function would not work properly for intersecting maps.

For example, I wanted to check that { "a": "x", "d": "z"} is indeed not a subset of { "a": "x", "b": "y", "c": "z"}

Related issues

#1173

@dolmen dolmen self-assigned this Jul 6, 2023
@dolmen dolmen added bug pkg-assert Change related to package testify/assert labels Jul 6, 2023
@dolmen
Copy link
Collaborator

dolmen commented Jul 6, 2023

Please rebase your branch on top of master and fix conflicts.

@Agurato Agurato closed this Jul 10, 2023
@Agurato
Copy link
Author

Agurato commented Jul 10, 2023

This has been fixed in #1261

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug must-rebase pkg-assert Change related to package testify/assert
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants