-
Couldn't load subscription status.
- Fork 1.8k
Fix crash when negating query with empty group #7234
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
base: releases
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -558,6 +558,41 @@ public void not() { | |
| } | ||
| } | ||
|
|
||
| @Test | ||
| public void emptyGroup() { | ||
| populateTestRealm(); // create TEST_DATA_SIZE objects | ||
| RealmResults<AllTypes> fives = realm.where(AllTypes.class) | ||
| .equalTo(AllTypes.FIELD_LONG, 5) | ||
| .beginGroup() | ||
| .endGroup() | ||
| .findAll(); | ||
| // Only on object with value 5 | ||
| assertEquals(1, fives.size()); | ||
| } | ||
|
|
||
| @Test (expected = UnsupportedOperationException.class) | ||
|
||
| public void or_emptyGroupThrows() { | ||
| populateTestRealm(); // create TEST_DATA_SIZE objects | ||
| RealmResults<AllTypes> fives = realm.where(AllTypes.class) | ||
rorbech marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| .equalTo(AllTypes.FIELD_LONG, 5) | ||
| .or() | ||
| .beginGroup() | ||
| .endGroup() | ||
| .findAll(); | ||
| } | ||
|
|
||
| @Test (expected = UnsupportedOperationException.class) | ||
| public void not_emptyGroup_throws() { | ||
| populateTestRealm(); // create TEST_DATA_SIZE objects | ||
| realm.where(AllTypes.class) | ||
| .equalTo(AllTypes.FIELD_LONG, 5) | ||
| .or() | ||
| .not() | ||
| .beginGroup() | ||
| .endGroup() | ||
| .findAll(); | ||
| } | ||
|
|
||
| @Test (expected = UnsupportedOperationException.class) | ||
| public void not_aloneThrows() { | ||
| // a not() alone must fail | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this throw as well?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No 🤷