@@ -707,6 +707,25 @@ describe "JavaScript grammar", ->
707707 expect ( tokens [ 6 ] ) . toEqual value: ' }' , scopes : [ 'source.js' , 'string.quoted.template.graphql.js' ]
708708 expect ( tokens [ 7 ] ) . toEqual value: '`' , scopes : [ 'source.js' , 'string.quoted.template.graphql.js' , 'punctuation.definition.string.end.js' ]
709709
710+ describe "ES6 tagged SQL string templates" , - >
711+ it "tokenizes them as strings" , - >
712+ { tokens} = grammar . tokenizeLine ( 'SQL`SELECT foo FROM bar WHERE id = :id`' )
713+ expect ( tokens [ 0 ] ) . toEqual value: 'SQL' , scopes : [ 'source.js' , 'string.quoted.template.sql.js' , 'entity.name.function.js' ]
714+ expect ( tokens [ 1 ] ) . toEqual value: '`' , scopes : [ 'source.js' , 'string.quoted.template.sql.js' , 'punctuation.definition.string.begin.js' ]
715+ expect ( tokens [ 2 ] ) . toEqual value: 'SELECT foo FROM bar WHERE id = :id' , scopes : [ 'source.js' , 'string.quoted.template.sql.js' ]
716+ expect ( tokens [ 3 ] ) . toEqual value: '`' , scopes : [ 'source.js' , 'string.quoted.template.sql.js' , 'punctuation.definition.string.end.js' ]
717+
718+ describe "ES6 tagged SQL string templates with interpolation" , - >
719+ it "tokenizes them as strings" , - >
720+ { tokens} = grammar . tokenizeLine ( 'SQL`SELECT foo FROM bar WHERE id = ${id}`' )
721+ expect ( tokens [ 0 ] ) . toEqual value: 'SQL' , scopes : [ 'source.js' , 'string.quoted.template.sql.js' , 'entity.name.function.js' ]
722+ expect ( tokens [ 1 ] ) . toEqual value: '`' , scopes : [ 'source.js' , 'string.quoted.template.sql.js' , 'punctuation.definition.string.begin.js' ]
723+ expect ( tokens [ 2 ] ) . toEqual value: 'SELECT foo FROM bar WHERE id = ' , scopes : [ 'source.js' , 'string.quoted.template.sql.js' ]
724+ expect ( tokens [ 3 ] ) . toEqual value: '${' , scopes : [ 'source.js' , 'string.quoted.template.sql.js' , 'source.js.embedded.source' , 'punctuation.section.embedded.js' ]
725+ expect ( tokens [ 4 ] ) . toEqual value: 'id' , scopes : [ 'source.js' , 'string.quoted.template.sql.js' , 'source.js.embedded.source' ]
726+ expect ( tokens [ 5 ] ) . toEqual value: '}' , scopes : [ 'source.js' , 'string.quoted.template.sql.js' , 'source.js.embedded.source' , 'punctuation.section.embedded.js' ]
727+ expect ( tokens [ 6 ] ) . toEqual value: '`' , scopes : [ 'source.js' , 'string.quoted.template.sql.js' , 'punctuation.definition.string.end.js' ]
728+
710729 describe "ES6 class" , - >
711730 it "tokenizes class" , - >
712731 { tokens} = grammar . tokenizeLine ( 'class MyClass' )
0 commit comments