-
-
Notifications
You must be signed in to change notification settings - Fork 209
feat: basic object merging #650
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b10f908
feat: basic object merging
b439cce
Improve description
c70b496
Use the merging somewhere useful
826d322
Make this a bit more robust
96cd844
Maybe fix memory leak in tests?
ab5b056
Do not explicitly include sentry.h, bad clangd
15f3877
fix minor bug
relaxolotl 8d35cbb
use macros since they're there
relaxolotl 078c473
use deep merging for contexts on an event as well
relaxolotl 1d63196
use merging when starting transactions
relaxolotl a057d52
address leaks in unit tests
relaxolotl 86c2470
Merge remote-tracking branch 'origin/master' into feat-basic-obj-merging
relaxolotl 242704c
missed a spot
relaxolotl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,6 +229,62 @@ SENTRY_TEST(value_object) | |
| sentry_value_decref(val); | ||
| } | ||
|
|
||
| SENTRY_TEST(value_object_merge) | ||
| { | ||
| sentry_value_t dst = sentry_value_new_object(); | ||
| sentry_value_set_by_key(dst, "a", sentry_value_new_int32(1)); | ||
| sentry_value_set_by_key(dst, "b", sentry_value_new_int32(2)); | ||
|
|
||
| sentry_value_t src = sentry_value_new_object(); | ||
| sentry_value_set_by_key(src, "b", sentry_value_new_int32(20)); | ||
| sentry_value_set_by_key(src, "c", sentry_value_new_int32(30)); | ||
|
|
||
| int rv = sentry__value_merge_objects(dst, src); | ||
| TEST_CHECK_INT_EQUAL(rv, 0); | ||
| sentry_value_decref(src); | ||
|
|
||
| sentry_value_t a = sentry_value_get_by_key(dst, "a"); | ||
| sentry_value_t b = sentry_value_get_by_key(dst, "b"); | ||
| sentry_value_t c = sentry_value_get_by_key(dst, "c"); | ||
| TEST_CHECK_INT_EQUAL(sentry_value_as_int32(a), 1); | ||
| TEST_CHECK_INT_EQUAL(sentry_value_as_int32(b), 20); | ||
| TEST_CHECK_INT_EQUAL(sentry_value_as_int32(c), 30); | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. huh, surely this commit can't be doing anything? I only inserts two blank lines? |
||
| sentry_value_decref(dst); | ||
| } | ||
|
|
||
| SENTRY_TEST(value_object_merge_nested) | ||
| { | ||
| sentry_value_t dst = sentry_value_new_object(); | ||
| sentry_value_set_by_key(dst, "a", sentry_value_new_int32(1)); | ||
| sentry_value_t dst_nested = sentry_value_new_object(); | ||
| sentry_value_set_by_key(dst_nested, "ba", sentry_value_new_int32(1)); | ||
| sentry_value_set_by_key(dst_nested, "bb", sentry_value_new_int32(2)); | ||
| sentry_value_set_by_key(dst, "b", dst_nested); | ||
|
|
||
| sentry_value_t src = sentry_value_new_object(); | ||
| sentry_value_t src_nested = sentry_value_new_object(); | ||
| sentry_value_set_by_key(src_nested, "bb", sentry_value_new_int32(20)); | ||
| sentry_value_set_by_key(src_nested, "bc", sentry_value_new_int32(30)); | ||
| sentry_value_set_by_key(src, "b", src_nested); | ||
|
|
||
| int rv = sentry__value_merge_objects(dst, src); | ||
| TEST_CHECK_INT_EQUAL(rv, 0); | ||
| sentry_value_decref(src); | ||
|
|
||
| sentry_value_t a = sentry_value_get_by_key(dst, "a"); | ||
| sentry_value_t nested = sentry_value_get_by_key(dst, "b"); | ||
| sentry_value_t ba = sentry_value_get_by_key(nested, "ba"); | ||
| sentry_value_t bb = sentry_value_get_by_key(nested, "bb"); | ||
| sentry_value_t bc = sentry_value_get_by_key(nested, "bc"); | ||
| TEST_CHECK_INT_EQUAL(sentry_value_as_int32(a), 1); | ||
| TEST_CHECK_INT_EQUAL(sentry_value_as_int32(ba), 1); | ||
| TEST_CHECK_INT_EQUAL(sentry_value_as_int32(bb), 20); | ||
| TEST_CHECK_INT_EQUAL(sentry_value_as_int32(bc), 30); | ||
|
|
||
| sentry_value_decref(dst); | ||
| } | ||
|
|
||
| SENTRY_TEST(value_freezing) | ||
| { | ||
| sentry_value_t val = sentry_value_new_list(); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.