From 02b865b21a576c03fe6ef8fb6a067c84b91c15c2 Mon Sep 17 00:00:00 2001 From: Ryan Tan Date: Tue, 17 Oct 2023 03:46:24 -0700 Subject: [PATCH] Add additional feature tests --- .../Gherkin/Gremlin.cs | 3 ++ gremlin-go/driver/cucumber/gremlin.go | 3 ++ .../test/cucumber/gremlin.js | 3 ++ .../src/main/python/radish/gremlin.py | 3 ++ .../test/features/map/Substring.feature | 36 +++++++++++++++++++ 5 files changed, 48 insertions(+) diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs index 66b3556e597..be261ba622a 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs @@ -1010,6 +1010,9 @@ private static IDictionary, ITraversal>> {(g,p) =>g.V().HasLabel("software").Values("name").Substring(1,4)}}, {"g_V_hasLabelXsoftwareX_valueXnameX_substringX1_0X", new List, ITraversal>> {(g,p) =>g.V().HasLabel("software").Values("name").Substring(1,0)}}, {"g_V_hasLabelXpersonX_valueXnameX_substringXneg3X", new List, ITraversal>> {(g,p) =>g.V().HasLabel("person").Values("name").Substring(-3)}}, + {"g_V_hasLabelXsoftwareX_valueXnameX_substringX1_neg1X", new List, ITraversal>> {(g,p) =>g.V().HasLabel("software").Values("name").Substring(1,-1)}}, + {"g_V_hasLabelXsoftwareX_valueXnameX_substringXneg4_2X", new List, ITraversal>> {(g,p) =>g.V().HasLabel("software").Values("name").Substring(-4,2)}}, + {"g_V_hasLabelXsoftwareX_valueXnameX_substringXneg3_neg1X", new List, ITraversal>> {(g,p) =>g.V().HasLabel("software").Values("name").Substring(-3,-1)}}, {"g_V_age_sum", new List, ITraversal>> {(g,p) =>g.V().Values("age").Sum()}}, {"g_V_foo_sum", new List, ITraversal>> {(g,p) =>g.V().Values("foo").Sum()}}, {"g_V_age_fold_sumXlocalX", new List, ITraversal>> {(g,p) =>g.V().Values("age").Fold().Sum(Scope.Local)}}, diff --git a/gremlin-go/driver/cucumber/gremlin.go b/gremlin-go/driver/cucumber/gremlin.go index 5c8cb4f7464..9b94834b330 100644 --- a/gremlin-go/driver/cucumber/gremlin.go +++ b/gremlin-go/driver/cucumber/gremlin.go @@ -981,6 +981,9 @@ var translationMap = map[string][]func(g *gremlingo.GraphTraversalSource, p map[ "g_V_hasLabelXsoftwareX_valueXnameX_substringX1_4X": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().HasLabel("software").Values("name").Substring(1, 4)}}, "g_V_hasLabelXsoftwareX_valueXnameX_substringX1_0X": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().HasLabel("software").Values("name").Substring(1, 0)}}, "g_V_hasLabelXpersonX_valueXnameX_substringXneg3X": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().HasLabel("person").Values("name").Substring(-3)}}, + "g_V_hasLabelXsoftwareX_valueXnameX_substringX1_neg1X": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().HasLabel("software").Values("name").Substring(1, -1)}}, + "g_V_hasLabelXsoftwareX_valueXnameX_substringXneg4_2X": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().HasLabel("software").Values("name").Substring(-4, 2)}}, + "g_V_hasLabelXsoftwareX_valueXnameX_substringXneg3_neg1X": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().HasLabel("software").Values("name").Substring(-3, -1)}}, "g_V_age_sum": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Values("age").Sum()}}, "g_V_foo_sum": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Values("foo").Sum()}}, "g_V_age_fold_sumXlocalX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Values("age").Fold().Sum(gremlingo.Scope.Local)}}, diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js index dee75645592..97557d86e73 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js @@ -1001,6 +1001,9 @@ const gremlins = { g_V_hasLabelXsoftwareX_valueXnameX_substringX1_4X: [function({g}) { return g.V().hasLabel("software").values("name").substring(1,4) }], g_V_hasLabelXsoftwareX_valueXnameX_substringX1_0X: [function({g}) { return g.V().hasLabel("software").values("name").substring(1,0) }], g_V_hasLabelXpersonX_valueXnameX_substringXneg3X: [function({g}) { return g.V().hasLabel("person").values("name").substring(-3) }], + g_V_hasLabelXsoftwareX_valueXnameX_substringX1_neg1X: [function({g}) { return g.V().hasLabel("software").values("name").substring(1,-1) }], + g_V_hasLabelXsoftwareX_valueXnameX_substringXneg4_2X: [function({g}) { return g.V().hasLabel("software").values("name").substring(-4,2) }], + g_V_hasLabelXsoftwareX_valueXnameX_substringXneg3_neg1X: [function({g}) { return g.V().hasLabel("software").values("name").substring(-3,-1) }], g_V_age_sum: [function({g}) { return g.V().values("age").sum() }], g_V_foo_sum: [function({g}) { return g.V().values("foo").sum() }], g_V_age_fold_sumXlocalX: [function({g}) { return g.V().values("age").fold().sum(Scope.local) }], diff --git a/gremlin-python/src/main/python/radish/gremlin.py b/gremlin-python/src/main/python/radish/gremlin.py index 081bf54530e..a03e0a8bd32 100644 --- a/gremlin-python/src/main/python/radish/gremlin.py +++ b/gremlin-python/src/main/python/radish/gremlin.py @@ -983,6 +983,9 @@ 'g_V_hasLabelXsoftwareX_valueXnameX_substringX1_4X': [(lambda g:g.V().hasLabel('software').name.substring(1,4))], 'g_V_hasLabelXsoftwareX_valueXnameX_substringX1_0X': [(lambda g:g.V().hasLabel('software').name.substring(1,0))], 'g_V_hasLabelXpersonX_valueXnameX_substringXneg3X': [(lambda g:g.V().hasLabel('person').name.substring(-3))], + 'g_V_hasLabelXsoftwareX_valueXnameX_substringX1_neg1X': [(lambda g:g.V().hasLabel('software').name.substring(1,-1))], + 'g_V_hasLabelXsoftwareX_valueXnameX_substringXneg4_2X': [(lambda g:g.V().hasLabel('software').name.substring(-4,2))], + 'g_V_hasLabelXsoftwareX_valueXnameX_substringXneg3_neg1X': [(lambda g:g.V().hasLabel('software').name.substring(-3,-1))], 'g_V_age_sum': [(lambda g:g.V().age.sum_())], 'g_V_foo_sum': [(lambda g:g.V().foo.sum_())], 'g_V_age_fold_sumXlocalX': [(lambda g:g.V().age.fold().sum_(Scope.local))], diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/Substring.feature b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/Substring.feature index ce475d96d33..48b77803557 100644 --- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/Substring.feature +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/Substring.feature @@ -92,3 +92,39 @@ Feature: Step - substring() | osh | | das | | ter | + +Scenario: g_V_hasLabelXsoftwareX_valueXnameX_substringX1_neg1X + Given the modern graph + And the traversal of + """ + g.V().hasLabel("software").values("name").substring(1, -1) + """ + When iterated to list + Then the result should be unordered + | result | + | o | + | ippl | + +Scenario: g_V_hasLabelXsoftwareX_valueXnameX_substringXneg4_2X + Given the modern graph + And the traversal of + """ + g.V().hasLabel("software").values("name").substring(-4, 2) + """ + When iterated to list + Then the result should be unordered + | result | + | lo | + | str[] | + +Scenario: g_V_hasLabelXsoftwareX_valueXnameX_substringXneg3_neg1X + Given the modern graph + And the traversal of + """ + g.V().hasLabel("software").values("name").substring(-3, -1) + """ + When iterated to list + Then the result should be unordered + | result | + | lo | + | pl | \ No newline at end of file