-
Notifications
You must be signed in to change notification settings - Fork 18
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
Conversation
848b7c5
to
e68f426
Compare
e68f426
to
d5d5258
Compare
@Override | ||
public CompletableFuture<?> getValue(EvalContext context) { | ||
return FutureUtil.sequence(pairs.getPairs().stream() | ||
.map(pair -> pair.getKey().getValue(context) |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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>>
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- BigDecimal is default numeric type in groovy.
- this case should be in 'should instantiate map with expression key defined in #input' spec.
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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 '
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
No description provided.