diff --git a/test/parser/hive/syntax.test.ts b/test/parser/hive/syntax.test.ts index e6f6da6..2ef6f36 100644 --- a/test/parser/hive/syntax.test.ts +++ b/test/parser/hive/syntax.test.ts @@ -2,17 +2,17 @@ import SQLParser from '../../../src/parser/hive'; describe('Hive SQL Syntax Tests', () => { const parser = new SQLParser(); - - test('Select Statement', () => { - const sql = 'SELECT * FROM employee WHERE salary>30000;'; - const result = parser.validate(sql); - - expect(result.length).toBe(0); - }); - - test('Select 1+1', () => { - const sql = 'SELECT 1+1;'; + test('Create Table Statement', () => { + const sql = 'CREATE TABLE person(name STRING,age INT);'; const result = parser.validate(sql); expect(result.length).toBe(0); }); -}); + test('Wrong Select Statement', () => { + const sql = 'SELECT add ABC from Where ;' + const result = parser.validate(sql); + console.log(result) + expect(result.length).toBe(2); + expect(result[0].message).toBe(`no viable alternative at input 'SELECTaddABCfromWhere'`) + expect(result[1].message).toBe(`mismatched input 'Where' expecting `) + }); +}); \ No newline at end of file