xiazcy commented on code in PR #2099:
URL: https://github.com/apache/tinkerpop/pull/2099#discussion_r1262812966


##########
gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/Concat.feature:
##########
@@ -0,0 +1,213 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+@StepClassMap @StepConcat
+Feature: Step - concat()
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_injectXa_bX_concat
+    Given the empty graph
+    And the traversal of
+      """
+      g.inject("a", "b").concat()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | a |
+      | b |
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_injectXa_bX_concat_XcX
+    Given the empty graph
+    And the traversal of
+      """
+      g.inject("a", "b").concat("c")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | ac |
+      | bc |
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_injectXa_bX_concat_Xc_dX
+    Given the empty graph
+    And the traversal of
+      """
+      g.inject("a", "b").concat("c", "d")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | acd |
+      | bcd |
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_injectXa_bX_concat_Xinject_c_dX
+    Given the empty graph
+    And the traversal of
+      """
+      g.inject("a", "b").concat(__.inject("c", "d"))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | acda |

Review Comment:
   My understanding of the spec is that concat appends the strings in the 
arguments together and then with the incoming traverser, with each traverser 
mapping to the results inside the arguments. 
   
   I'm using TraversalUtil.applyAll to get the result of the child traversal, 
and In this case, "a" is appended in front of the "c" and "d" injected. Then 
for inject itself, it appends the "a" from the parent to the end. Then the map 
operation will move to the next incoming traverser "b" then does the same thing:
   ```
   g.inject("a", "b").concat(__.inject("c", "d"))
   ==>acdb
   ==>bcdb
   ```
   
   We thought about getting `ac` and `bd`, but weren't sure of how useful it 
would be, as we'd expect things inside the concat() to be concatenated 
together. As well given a map operation, if we injected 3 items, then the 3rd 
one wouldn't be returned since there are only two incoming traversers. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to