File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -58,5 +58,22 @@ test('template lexer', {
5858 assert . equal ( tokens ( 'SELECT `"' , '`' ) , '`,_' ) ;
5959 assert . equal ( tokens ( 'SELECT ```' , '`' ) , '`,_' ) ;
6060 assert . equal ( tokens ( 'SELECT `\\`' , '`' ) , '`,_' ) ;
61+ } ,
62+ 'replay error' : function ( ) {
63+ const lexer = Lexer . makeLexer ( ) ;
64+ assert . equal ( lexer ( 'SELECT ' ) , null ) ;
65+ assert . throws (
66+ ( ) => lexer ( ' # ' ) ,
67+ / ^ E r r o r : E x p e c t e d d e l i m i t e r a t " # " $ / ) ;
68+ // Providing more input throws the same error.
69+ assert . throws (
70+ ( ) => lexer ( ' ' ) ,
71+ / ^ E r r o r : E x p e c t e d d e l i m i t e r a t " # " $ / ) ;
72+ } ,
73+ 'unfinished escape squence' : function ( ) {
74+ const lexer = Lexer . makeLexer ( ) ;
75+ assert . throws (
76+ ( ) => lexer ( 'SELECT "\\' ) ,
77+ / ^ E r r o r : E x p e c t e d " \\ \\ " a t " \\ \\ " $ / ) ;
6178 }
6279} ) ;
You can’t perform that action at this time.
0 commit comments