chroe: devops (#180)
* ci: add dependencies about lint tool * ci: replace eslint with prettier * ci: add husky, cz and commitlint * style: lint fix via prettier * ci: add prettier and check-types to github workflow '
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { ParseTreeListener } from 'antlr4ts/tree';
|
||||
import { Target_listContext } from '../../../src/lib/pgsql/PostgreSQLParser';
|
||||
import { PostgreSQLParserListener } from '../../../src/lib/pgsql/PostgreSQLParserListener';
|
||||
import PostgresSQL from '../../../src/parser/pgsql';
|
||||
@ -16,9 +17,9 @@ describe('PostgresSQL Listener Tests', () => {
|
||||
result = ctx.text.toLowerCase();
|
||||
}
|
||||
}
|
||||
const listenTableName: any = new MyListener();
|
||||
const listenTableName = new MyListener();
|
||||
|
||||
await parser.listen(listenTableName, parserTree);
|
||||
await parser.listen(listenTableName as ParseTreeListener, parserTree);
|
||||
expect(result).toBe(expectTableName);
|
||||
});
|
||||
});
|
||||
|
@ -1,14 +1,14 @@
|
||||
import PostgresSQL from "../../../src/parser/pgsql";
|
||||
import { readSQL } from "../../helper";
|
||||
import PostgresSQL from '../../../src/parser/pgsql';
|
||||
import { readSQL } from '../../helper';
|
||||
|
||||
const parser = new PostgresSQL();
|
||||
|
||||
const features = {
|
||||
base: readSQL(__dirname, "select.sql"),
|
||||
base: readSQL(__dirname, 'select.sql'),
|
||||
};
|
||||
|
||||
describe("Postgre SQL Query Statement Tests", () => {
|
||||
describe("Base Select", () => {
|
||||
describe('Postgre SQL Query Statement Tests', () => {
|
||||
describe('Base Select', () => {
|
||||
features.base.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import PostgresSQL from "../../../src/parser/pgsql";
|
||||
import PostgresSQL from '../../../src/parser/pgsql';
|
||||
|
||||
describe('PostgresSQL SQL Syntax Tests', () => {
|
||||
const parser = new PostgresSQL();
|
||||
@ -21,5 +21,4 @@ describe('PostgresSQL SQL Syntax Tests', () => {
|
||||
const result = parser.validate(sql);
|
||||
expect(result.length).toBe(0);
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { AbstractParseTreeVisitor } from "antlr4ts/tree/AbstractParseTreeVisitor";
|
||||
import { PostgreSQLParserVisitor } from "../../../src/lib/pgsql/PostgreSQLParserVisitor";
|
||||
import PostgresSQL from "../../../src/parser/pgsql";
|
||||
import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor';
|
||||
import { PostgreSQLParserVisitor } from '../../../src/lib/pgsql/PostgreSQLParserVisitor';
|
||||
import PostgresSQL from '../../../src/parser/pgsql';
|
||||
|
||||
describe('Generic SQL Visitor Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
@ -13,11 +13,14 @@ describe('Generic SQL Visitor Tests', () => {
|
||||
|
||||
test('Visitor visitTableName', () => {
|
||||
let result = '';
|
||||
class MyVisitor extends AbstractParseTreeVisitor<any> implements PostgreSQLParserVisitor<any> {
|
||||
class MyVisitor
|
||||
extends AbstractParseTreeVisitor<any>
|
||||
implements PostgreSQLParserVisitor<any>
|
||||
{
|
||||
protected defaultResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
visitTable_ref(ctx) {
|
||||
result = ctx.text.toLowerCase();
|
||||
}
|
||||
|
Reference in New Issue
Block a user