Skip to content
This repository has been archived by the owner on Dec 26, 2019. It is now read-only.

Fix parsing of predicate string #456

Closed
wants to merge 1 commit into from
Closed

Fix parsing of predicate string #456

wants to merge 1 commit into from

Conversation

imurchie
Copy link
Contributor

This was not able to get the actual suffix, since it modified the property name as it went. Instead it should pull the substrings from the original property name. Also substringFromIndex is inclusive, so we need to go from one past the position of the dot.

actualPropName = [actualPropName substringToIndex:dotPos];
NSString *suffix = [actualPropName substringFromIndex:dotPos];
NSString *actualPropName = [propName substringToIndex:dotPos];
NSString *suffix = [propName substringFromIndex:(dotPos + 1)];
return [NSExpression expressionForKeyPath:[NSString stringWithFormat:@"%@.%@", [FBElementUtils wdAttributeNameForAttributeName:actualPropName], suffix]];
Copy link
Contributor

Choose a reason for hiding this comment

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

could you please add unit test for such case? The tests container is located in UnitTests folder, NSExpressionFBFormatTests.m file.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the existing unit tests to make useful assertions.

@facebook-github-bot
Copy link

@marekcirkos has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

imurchie referenced this pull request in appium/WebDriverAgent Nov 16, 2017
* Try to reuse running WDA instance and tune WDA startup logic

* Add more detailed issue description

* Tune retries count

* Avoid error message duplication

* Tune max line lengths

* Keep real device tutorial URL in a separate constant
dpgraham pushed a commit to dpgraham/appium-ios that referenced this pull request Sep 9, 2020
Summary:
This was not able to get the actual suffix, since it modified the property name as it went. Instead it should pull the substrings from the original property name. Also `substringFromIndex` is inclusive, so we need to go from one past the position of the dot.
Closes facebookarchive/WebDriverAgent#456

Differential Revision: D4461673

Pulled By: marekcirkos

fbshipit-source-id: ee734ef672fa8630e61a0fb73cf74cc8d5dbdb82
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants