test: split special sqls

This commit is contained in:
xiaowei 2021-09-08 20:33:30 +08:00 committed by Ziv
parent bb6e8ac025
commit 850b6087fd

View File

@ -7,6 +7,7 @@ describe('utils', () => {
const result = splitSql(sql); const result = splitSql(sql);
expect(result.length).toEqual(1); expect(result.length).toEqual(1);
}); });
test('split multiple sql', () => { test('split multiple sql', () => {
const sql = `-- a ; const sql = `-- a ;
select * from a; select * from a;
@ -18,6 +19,14 @@ describe('utils', () => {
const result = splitSql(sql); const result = splitSql(sql);
expect(result.length).toEqual(2); expect(result.length).toEqual(2);
}); });
test('split special quotation sql', () => {
const sql = `select regexp_replace('a', 'bc', 'xfe'feefe', '233');
select regexp_replace('abc', "fe", '233');`;
const result = splitSql(sql);
expect(result.length).toEqual(2);
});
test('lexer', () => { test('lexer', () => {
const sql = `-- a ; const sql = `-- a ;
select * from a; select * from a;