MCPcopy Create free account
hub / github.com/araddon/qlbridge / TestLexCommentTypes

Function TestLexCommentTypes

lex/lexer_test.go:312–358  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

310}
311
312func TestLexCommentTypes(t *testing.T) {
313 verifyTokens(t, `--hello
314-- multiple single -- / # line comments w /* more */
315SELECT x FROM mytable`,
316 []Token{
317 tv(TokenCommentSingleLine, "--"),
318 tv(TokenComment, "hello"),
319 tv(TokenCommentSingleLine, "--"),
320 tv(TokenComment, " multiple single -- / # line comments w /* more */"),
321 tv(TokenSelect, "SELECT"),
322 tv(TokenIdentity, "x"),
323 tv(TokenFrom, "FROM"),
324 tv(TokenIdentity, "mytable"),
325 })
326
327 verifyTokens(t, `// hello
328-- multiple single line comments
329# with hash
330SELECT x FROM mytable`,
331 []Token{
332 tv(TokenCommentSlashes, "//"),
333 tv(TokenComment, " hello"),
334 tv(TokenCommentSingleLine, "--"),
335 tv(TokenComment, " multiple single line comments"),
336 tv(TokenCommentHash, "#"),
337 tv(TokenComment, " with hash"),
338 tv(TokenSelect, "SELECT"),
339 tv(TokenIdentity, "x"),
340 tv(TokenFrom, "FROM"),
341 tv(TokenIdentity, "mytable"),
342 })
343
344 verifyTokens(t, `/*
345hello
346multiline
347*/
348/* and more */
349SELECT x FROM mytable`,
350 []Token{
351 tv(TokenCommentML, "\nhello\nmultiline\n"),
352 tv(TokenCommentML, " and more "),
353 tv(TokenSelect, "SELECT"),
354 tv(TokenIdentity, "x"),
355 tv(TokenFrom, "FROM"),
356 tv(TokenIdentity, "mytable"),
357 })
358}
359
360func TestLexSqlIdentities(t *testing.T) {
361 // http://stackoverflow.com/questions/1992314/what-is-the-difference-between-single-and-double-quotes-in-sql

Callers

nothing calls this directly

Calls 2

verifyTokensFunction · 0.70
tvFunction · 0.70

Tested by

no test coverage detected