Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Array expression literal #11457

Merged
merged 1 commit into from
Mar 16, 2018
Merged

Array expression literal #11457

merged 1 commit into from
Mar 16, 2018

Conversation

tobrun
Copy link
Member

@tobrun tobrun commented Mar 15, 2018

Closes #11421, this PR adds correct integration for literal(Object[]):

Not commited but a small end-to-end test with:

  Object[] objectArray = new Object[]{1, "hello"};
  Expression textFieldExpression =  Expression.toString(length(literal(objectArray)));

Results in showing 2 as symbol text in:

screen shot 2018-03-15 at 11 10 22

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Mar 15, 2018
@tobrun tobrun added this to the android-v6.0.0 milestone Mar 15, 2018
@tobrun tobrun self-assigned this Mar 15, 2018
@tobrun tobrun requested a review from LukasPaczos March 15, 2018 10:15
Object[] stopZero = new Object[] {0, 1};
Object[] stopOne = new Object[] {1, 2};
Object[] stopTwo = new Object[] {2, 3};
Object[] expected = new Object[] {"interpolate", new Object[] {"linear"}, 12, stopZero, stopOne, stopTwo};
Copy link
Member Author

@tobrun tobrun Mar 15, 2018

Choose a reason for hiding this comment

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

above construction for stops wasn't correct, stops are not allowed to be nested arrays

Object[] actual = at(literal(3), literal(new Object[] {"one", "two"})).toArray();
assertTrue("expression should match", Arrays.deepEquals(expected, actual));
}

@Test
public void testAtLiteral() throws Exception {
Object[] expected = new Object[] {"at", 3, new Object[] {"one", "two"}};
Object[] expected = new Object[] {"at", 3, new Object[] {"literal", new Object[] {"one", "two"}}};
Copy link
Member Author

Choose a reason for hiding this comment

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

had to update this line as this syntax would be required to pass in an Object[] to core

@tobrun tobrun force-pushed the tvn-array-expression-literal branch from b267e55 to 50b1742 Compare March 15, 2018 10:53
@tobrun tobrun merged commit aba24da into release-boba Mar 16, 2018
@tobrun tobrun deleted the tvn-array-expression-literal branch March 16, 2018 16:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants