lava-oushudb-dt-sql-parser/test/parser/mysql/syntax/other.test.ts
Hayden bb0fad1dbe
refactor: standard naming (#278)
* refactor: rename flinksql to flink

* refactor: rename pgsql to postgresql

* refactor: rename trinosql to trino

* refactor: replace all default exports with named export

* refactor: rename basicParser to basicSQL

* refactor: rename basic-parser-types to types

* refactor: replace arrow func with plain func
2024-03-27 10:33:25 +08:00

37 lines
1.5 KiB
TypeScript

import { MySQL } from 'src/parser/mysql';
import { readSQL } from 'test/helper';
const mysql = new MySQL();
const features = {
commit: readSQL(__dirname, 'commit.sql'),
savePoint: readSQL(__dirname, 'savePoint.sql'),
lockTable: readSQL(__dirname, 'lockTable.sql'),
setTransaction: readSQL(__dirname, 'setTransaction.sql'),
xaTransactions: readSQL(__dirname, 'xaTransactions.sql'),
replication: readSQL(__dirname, 'replication.sql'),
prepared: readSQL(__dirname, 'prepared.sql'),
changeMasterTo: readSQL(__dirname, 'changeMasterTo.sql'),
changeReplicationFilter: readSQL(__dirname, 'changeReplicationFilter.sql'),
changeReplicationSource: readSQL(__dirname, 'changeReplicationSource.sql'),
resetSlaveOrReplica: readSQL(__dirname, 'resetSlaveOrReplica.sql'),
startSlaveOrReplica: readSQL(__dirname, 'startSlaveOrReplica.sql'),
stopSlaveOrReplica: readSQL(__dirname, 'stopSlaveOrReplica.sql'),
groupReplication: readSQL(__dirname, 'groupReplication.sql'),
utility: readSQL(__dirname, 'utility.sql'),
};
describe('MySQL Transactional and Locking, Replication, Prepared Compound and Utility Syntax Tests', () => {
Object.keys(features).forEach((key) => {
features[key].forEach((sql) => {
it(sql, () => {
const result = mysql.validate(sql);
if (result.length) {
console.error(result, `\nPlease check sql: ${sql}`);
}
expect(result.length).toBe(0);
});
});
});
});