-
-
Notifications
You must be signed in to change notification settings - Fork 300
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
Refactor NSExpression unit tests #421
Comments
Working in progress in here: https://github.com/maplibre/maplibre-gl-native/tree/refactor-nsexpression-unit-tests |
@roblabs , do you know how to write [NSExpression expressionWithFormat:@"MGL_FUNCTION('image', 'Icon Image')"]; With the new syntax? |
@birkskyum — the expression While I was researching the source for #331 & PR #411, I found documentation for the expression in "Predicates and Expressions.md": But the Objective-C source mentions that it is not implemented. - (id)MGL_FUNCTION:(id)firstArgument, ... {
[NSException raise:NSInvalidArgumentException
format:@"Mapbox GL function expressions lack underlying Objective-C implementations."];
return nil;
} In general, I found that writing the expressions in Swift first was easier to sort out than in Objective-C. |
The MapLibre GL JS update is blocked by this because the test files are generated. #816 |
I found that some of these tests only can be enabled again by porting them to swift. The swift syntax is more flexible and we have cases that aren't supported by obj-c anymore. |
Because of that, I don't plan to look further into refactoring the obj-c code as it seemed futile. |
OK thanks for the update. |
This just tells you that it’s an abstract class.
|
There isn’t a separate Swift syntax. You may be referring to the “MGL” convenience initializers on NSExpression, which are also available in Objective-C. These initializers are more type-safe but not as flexible as anything that uses an expression function. The tests were originally intended to catch the situation where the longstanding trick to installing an aftermarket function ceased to be supported on iOS or macOS. If that has finally happened, then some code can switch to the initializers as in the examples in #411, but more dynamic code needs a different solution. As noted in #331 (comment), the initializers may not work in some cases, because they’re converted to the aftermarket functions under the hood anyways. |
The unit tests are generated so should not be edited manually. Instead the template that generates them should be fixed: |
Remove all XCTExpectFailure from macos/ios/darwin test suites introduced in #411 by refactoring the tests to the new format. Related to #331
The text was updated successfully, but these errors were encountered: