kenhuuu commented on code in PR #3673:
URL: https://github.com/apache/tinkerpop/pull/3673#discussion_r4089784454
##########
gremlin-go/driver/gremlinlang_test.go:
##########
@@ -717,6 +717,20 @@ func Test_GremlinLang(t *testing.T) {
},
equals: `g.inject(Binary("AA=="))`,
},
+ {
+ name: "g_Inject_Char",
+ assert: func(g *GraphTraversalSource) *GraphTraversal {
+ return g.Inject(Char('a'))
+ },
+ equals: `g.inject("a"c)`,
+ },
+ {
+ name: "g_Inject_Char_EscapedQuote",
+ assert: func(g *GraphTraversalSource) *GraphTraversal {
+ return g.Inject(Char('"'))
+ },
+ equals: `g.inject("\""c)`,
+ },
Review Comment:
I think we should probably add some more cases here like we did with
gremlin-python:
```
Char('\\') // g.inject("\\"c)
Char('\'') // g.inject("'"c)
Char('\n') // g.inject("\n"c)
rune('a') // g.inject(97), confirming rune remains Int
```
##########
gremlin-js/gremlin-javascript/test/unit/translator/gremlin-translator-test.js:
##########
@@ -285,6 +285,8 @@ describe('GoTranslateVisitor', function () {
['g.inject(Duration(9000,0))', 'g.Inject(time.Duration(9000000000000))'],
// Binary literal
['g.inject(Binary("AQID"))', 'g.Inject(gremlingo.ByteBuffer{Data:
[]byte{1,2,3}})'],
+ // Character literal
+ ['g.inject("a"c)', "g.Inject(gremlingo.Char('a'))"],
Review Comment:
I think we should have more tests here too. same as the ones I said with
gremlinlang
```
"a"c
"\""c
"\\"c
"'"c
'\''c
```
that last one is particularly important because I think it might be a bug.
```
// Current, invalid Go
gremlingo.Char(''')
// Required
gremlingo.Char('\'')
```
also, Gremlin supports one- and two-digit octal escapes
```
"\7"c
"\07"c
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]