summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2018-03-29 04:09:13 -0700
committerMinh Nguyễn <mxn@1ec5.org>2018-03-29 04:09:13 -0700
commit2625c7c215bbb6b063fac4e941a04c064ff56b43 (patch)
tree3a9f0a98a850d9ab7345141b956db4b8ad843924
parenta51ae903e8072e732bad2a63fc142ab4bbb5caf2 (diff)
downloadqtlocation-mapboxgl-2625c7c215bbb6b063fac4e941a04c064ff56b43.tar.gz
[ios, macos] Documented simple lookup
-rw-r--r--platform/darwin/docs/guides/For Style Authors.md.ejs2
-rw-r--r--platform/darwin/test/MGLExpressionTests.mm14
2 files changed, 9 insertions, 7 deletions
diff --git a/platform/darwin/docs/guides/For Style Authors.md.ejs b/platform/darwin/docs/guides/For Style Authors.md.ejs
index ecd1f6af41..fb1fd3b3c0 100644
--- a/platform/darwin/docs/guides/For Style Authors.md.ejs
+++ b/platform/darwin/docs/guides/For Style Authors.md.ejs
@@ -341,7 +341,7 @@ In style specification | Method, function, or predicate type | Format string syn
`geometry-type` | |`$mgl_geometryType`
`id` | |`$mgl_featureIdentifier`
`properties` | |`$mgl_featureProperties`
-`at` | `objectFrom:withIndex:` |
+`at` | `objectFrom:withIndex:` | `array[n]`
`get` | `+[NSExpression expressionForKeyPath:]` | Key path
`has` | `mgl_hasProperty:properties:` |
`length` | `count:` | `count({1, 2, 2, 3, 4, 7, 9})`
diff --git a/platform/darwin/test/MGLExpressionTests.mm b/platform/darwin/test/MGLExpressionTests.mm
index 9c6a454943..10c627abf4 100644
--- a/platform/darwin/test/MGLExpressionTests.mm
+++ b/platform/darwin/test/MGLExpressionTests.mm
@@ -701,18 +701,20 @@ using namespace std::string_literals;
- (void)testLookupExpressionObject {
{
NSExpression *array = [NSExpression expressionForAggregate:@[MGLConstantExpression(@9),
- MGLConstantExpression(@8),
- MGLConstantExpression(@7)]];
- NSExpression *expression = [NSExpression expressionForFunction:@"objectFrom:withIndex:" arguments:@[array, MGLConstantExpression(@1)]];
+ MGLConstantExpression(@8),
+ MGLConstantExpression(@7)]];
+ NSExpression *expression = [NSExpression expressionForFunction:@"objectFrom:withIndex:"
+ arguments:@[array, MGLConstantExpression(@1)]];
NSArray *jsonExpression = @[@"at", @1, @[ @"literal", @[@9, @8, @7]]];
XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression);
XCTAssertEqualObjects([NSExpression mgl_expressionWithJSONObject:jsonExpression], expression);
}
{
NSExpression *array = [NSExpression expressionForAggregate:@[MGLConstantExpression(@9),
- MGLConstantExpression(@8),
- MGLConstantExpression(@7)]];
- NSExpression *expression = [NSExpression expressionForFunction:@"objectFrom:withIndex:" arguments:@[array, [NSExpression expressionForKeyPath:@"x"]]];
+ MGLConstantExpression(@8),
+ MGLConstantExpression(@7)]];
+ NSExpression *expression = [NSExpression expressionForFunction:@"objectFrom:withIndex:"
+ arguments:@[array, [NSExpression expressionForKeyPath:@"x"]]];
NSArray *jsonExpression = @[@"at", @[@"get", @"x"], @[ @"literal", @[@9, @8, @7]]];
XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression);
XCTAssertEqualObjects([NSExpression mgl_expressionWithJSONObject:jsonExpression], expression);