Skip to content
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

Maps instantation #23

Merged
merged 7 commits into from
Oct 19, 2016
Merged

Maps instantation #23

merged 7 commits into from
Oct 19, 2016

Conversation

rzukow
Copy link
Contributor

@rzukow rzukow commented Oct 18, 2016

No description provided.

@Override
public CompletableFuture<?> getValue(EvalContext context) {
return FutureUtil.sequence(pairs.getPairs().stream()
.map(pair -> pair.getKey().getValue(context)
Copy link
Contributor

@tfij tfij Oct 19, 2016

Choose a reason for hiding this comment

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

what about add method toEntry in PairNode class? or a method on PairsListNode?

}

@Override
public CompletableFuture<?> getValue(EvalContext context) {
Copy link
Contributor

@tfij tfij Oct 19, 2016

Choose a reason for hiding this comment

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

CompletableFuture<?> -> CompletableFuture<Map<Object, Object>>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

"{x:2}" || [x: 2]
"({'x': 2 })" || [x: 2]
"{'x': 2, 'y':3 }" || [x: 2, y: 3]
"{(1+1): 2, 'y':3 }" || [(BigDecimal.valueOf(2)): 2, y: 3]
Copy link
Contributor

@tfij tfij Oct 19, 2016

Choose a reason for hiding this comment

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

  1. BigDecimal is default numeric type in groovy.
  2. this case should be in 'should instantiate map with expression key defined in #input' spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ad. 1. it doesn't work without converting to BigDecimal
Ad. 2.fixed

input || expResult
"{}" || [:]
"{'x':2}" || [x: 2]
"{x:2}" || [x: 2]
Copy link
Contributor

Choose a reason for hiding this comment

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

what if val x is defined? do we need notation without '?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good question, x will be parsed as identifier, no matter if value x exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

notation without ' is a nice syntactic sugar IMO

@@ -34,6 +69,7 @@ class OpelEngineMapIntegrationSpec extends Specification {

where:
input || expResult
"{x:2, y:5}.x" || 2
Copy link
Contributor

Choose a reason for hiding this comment

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

add some test when map is assigned to some val. Now we test access to anonymous map and map from context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

@rzukow rzukow merged commit 8c87e95 into master Oct 19, 2016
@rzukow rzukow deleted the mapsInstantation branch October 19, 2016 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants