summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmkiley <jordan.kiley@mapbox.com>2018-10-12 11:14:41 -0700
committerjmkiley <jordan.kiley@mapbox.com>2018-10-12 11:14:41 -0700
commit436e3ce430e83ba93a6e79f24788b302dc2a9839 (patch)
tree9c8bc0179155e8ecc7818fa9e6d937bf844d1983
parent72eba4d8614acd09d2408a983f8d99313ff9b995 (diff)
downloadqtlocation-mapboxgl-436e3ce430e83ba93a6e79f24788b302dc2a9839.tar.gz
[ios, macos] fixed a test, documented length is unavailable
-rw-r--r--platform/darwin/src/NSExpression+MGLAdditions.h2
-rw-r--r--platform/darwin/src/NSExpression+MGLAdditions.mm4
-rw-r--r--platform/darwin/test/MGLExpressionTests.mm12
-rw-r--r--platform/darwin/test/MGLOfflineStorageTests.mm1
4 files changed, 10 insertions, 9 deletions
diff --git a/platform/darwin/src/NSExpression+MGLAdditions.h b/platform/darwin/src/NSExpression+MGLAdditions.h
index d13f0227b4..43acde15ce 100644
--- a/platform/darwin/src/NSExpression+MGLAdditions.h
+++ b/platform/darwin/src/NSExpression+MGLAdditions.h
@@ -173,6 +173,8 @@ FOUNDATION_EXTERN MGL_EXPORT const MGLExpressionInterpolationMode MGLExpressionI
guide for a correspondence of operators and types between the style
specification and the `NSExpression` representation used by this SDK.
+ Note that the `length` argument is not currently supported with iOS 8.
+
You can use `NSJSONSerialization` to serialize the Foundation object as data to
write to a file.
*/
diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm
index 59b0cd3479..3146872a27 100644
--- a/platform/darwin/src/NSExpression+MGLAdditions.mm
+++ b/platform/darwin/src/NSExpression+MGLAdditions.mm
@@ -843,9 +843,9 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) {
NSPredicate *conditional = [arguments.firstObject constantValue];
return [NSExpression expressionForConditional:conditional trueExpression:arguments[1] falseExpression:arguments[2]];
}
- } else {
- return [NSExpression expressionForFunction:@"MGL_IF" arguments:arguments];
}
+
+ return [NSExpression expressionForFunction:@"MGL_IF" arguments:arguments];
} else if ([op isEqualToString:@"match"]) {
NSMutableArray *optionsArray = [NSMutableArray array];
diff --git a/platform/darwin/test/MGLExpressionTests.mm b/platform/darwin/test/MGLExpressionTests.mm
index 39f08eda00..7e091a7f05 100644
--- a/platform/darwin/test/MGLExpressionTests.mm
+++ b/platform/darwin/test/MGLExpressionTests.mm
@@ -620,11 +620,12 @@ using namespace std::string_literals;
XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression);
}
{
- // TODO JK: caught "NSInternalInconsistencyException", "length: is not a supported method."
- NSExpression *expression = [NSExpression expressionForFunction:@"length:" arguments:arguments];
- NSArray *jsonExpression = @[@"length", @"MacDonald"];
- XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression);
- XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression);
+ if (@available(iOS 9.0, *)) {
+ NSExpression *expression = [NSExpression expressionForFunction:@"length:" arguments:arguments];
+ NSArray *jsonExpression = @[@"length", @"MacDonald"];
+ XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression);
+ XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression);
+ }
}
}
@@ -1099,7 +1100,6 @@ using namespace std::string_literals;
@80000
],
@[@"get", @"abbr"],
- // TODO JK - ((localizedExpression.mgl_jsonExpressionObject) equal to (localizedJSONExpression)) failed: throwing "*** -constantValue only defined for abstract class. Define -[NSKeyPathExpression constantValue]!"
@[@"get", @"name"]
],
@5, @[@"get", @"name"]
diff --git a/platform/darwin/test/MGLOfflineStorageTests.mm b/platform/darwin/test/MGLOfflineStorageTests.mm
index c02ec379b6..ad6e1a0570 100644
--- a/platform/darwin/test/MGLOfflineStorageTests.mm
+++ b/platform/darwin/test/MGLOfflineStorageTests.mm
@@ -266,7 +266,6 @@
auto fs = os.mbglFileSource;
- // TODO JK - Getting failures
// Delegate returns "https://api.mapbox.com" as a replacement URL.
const mbgl::Resource resource { mbgl::Resource::Unknown, "test://api" };
std::unique_ptr<mbgl::AsyncRequest> req;