diff --git a/jest.config.js b/jest.config.js index fa262a0..9361895 100644 --- a/jest.config.js +++ b/jest.config.js @@ -4,187 +4,181 @@ */ module.exports = { - // All imported modules in your tests should be mocked automatically - // automock: false, + // All imported modules in your tests should be mocked automatically + // automock: false, - // Stop running tests after `n` failures - // bail: 0, + // Stop running tests after `n` failures + // bail: 0, - // The directory where Jest should store its cached dependency information - // cacheDirectory: "/private/var/folders/70/21p94l8j6cd9vv9t990g8cj00000gn/T/jest_dx", + // The directory where Jest should store its cached dependency information + // cacheDirectory: "/private/var/folders/70/21p94l8j6cd9vv9t990g8cj00000gn/T/jest_dx", - // Automatically clear mock calls, instances, contexts and results before every test - clearMocks: true, + // Automatically clear mock calls, instances, contexts and results before every test + clearMocks: true, - // Indicates whether the coverage information should be collected while executing the test - collectCoverage: true, + // Indicates whether the coverage information should be collected while executing the test + collectCoverage: true, - // An array of glob patterns indicating a set of files for which coverage information should be collected - // collectCoverageFrom: undefined, + // An array of glob patterns indicating a set of files for which coverage information should be collected + // collectCoverageFrom: undefined, - // The directory where Jest should output its coverage files - coverageDirectory: "coverage", + // The directory where Jest should output its coverage files + coverageDirectory: 'coverage', - // An array of regexp pattern strings used to skip coverage collection - // coveragePathIgnorePatterns: [ - // "/node_modules/" - // ], + // An array of regexp pattern strings used to skip coverage collection + // coveragePathIgnorePatterns: [ + // "/node_modules/" + // ], - // Indicates which provider should be used to instrument code for coverage - // coverageProvider: "babel", + // Indicates which provider should be used to instrument code for coverage + // coverageProvider: "babel", - // A list of reporter names that Jest uses when writing coverage reports - // coverageReporters: [ - // "json", - // "text", - // "lcov", - // "clover" - // ], + // A list of reporter names that Jest uses when writing coverage reports + // coverageReporters: [ + // "json", + // "text", + // "lcov", + // "clover" + // ], - // An object that configures minimum threshold enforcement for coverage results - // coverageThreshold: undefined, + // An object that configures minimum threshold enforcement for coverage results + // coverageThreshold: undefined, - // A path to a custom dependency extractor - // dependencyExtractor: undefined, + // A path to a custom dependency extractor + // dependencyExtractor: undefined, - // Make calling deprecated APIs throw helpful error messages - // errorOnDeprecated: false, + // Make calling deprecated APIs throw helpful error messages + // errorOnDeprecated: false, - // The default configuration for fake timers - // fakeTimers: { - // "enableGlobally": false - // }, + // The default configuration for fake timers + // fakeTimers: { + // "enableGlobally": false + // }, - // Force coverage collection from ignored files using an array of glob patterns - // forceCoverageMatch: [], + // Force coverage collection from ignored files using an array of glob patterns + // forceCoverageMatch: [], - // A path to a module which exports an async function that is triggered once before all test suites - // globalSetup: undefined, + // A path to a module which exports an async function that is triggered once before all test suites + // globalSetup: undefined, - // A path to a module which exports an async function that is triggered once after all test suites - // globalTeardown: undefined, + // A path to a module which exports an async function that is triggered once after all test suites + // globalTeardown: undefined, - // A set of global variables that need to be available in all test environments - // globals: {}, + // A set of global variables that need to be available in all test environments + // globals: {}, - // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. - // maxWorkers: "50%", + // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. + // maxWorkers: "50%", - // An array of directory names to be searched recursively up from the requiring module's location - // moduleDirectories: [ - // "node_modules" - // ], + // An array of directory names to be searched recursively up from the requiring module's location + // moduleDirectories: [ + // "node_modules" + // ], - // An array of file extensions your modules use - moduleFileExtensions: [ - "js", - "mjs", - "cjs", - "jsx", - "ts", - "tsx", - "json", - "node", - ], + // An array of file extensions your modules use + moduleFileExtensions: ['js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx', 'json', 'node'], - // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module - // moduleNameMapper: {}, + // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module + moduleNameMapper: { + '^src/(.*)$': '/src/$1', + '^test/(.*)$': '/test/$1', + }, - // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader - // modulePathIgnorePatterns: [], + // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader + // modulePathIgnorePatterns: [], - // Activates notifications for test results - // notify: false, + // Activates notifications for test results + // notify: false, - // An enum that specifies notification mode. Requires { notify: true } - // notifyMode: "failure-change", + // An enum that specifies notification mode. Requires { notify: true } + // notifyMode: "failure-change", - // A preset that is used as a base for Jest's configuration - // preset: "ts-jest/presets/js-with-ts-esm", + // A preset that is used as a base for Jest's configuration + // preset: "ts-jest/presets/js-with-ts-esm", - // Run tests from one or more projects - // projects: undefined, + // Run tests from one or more projects + // projects: undefined, - // Use this configuration option to add custom reporters to Jest - // reporters: undefined, + // Use this configuration option to add custom reporters to Jest + // reporters: undefined, - // Automatically reset mock state before every test - // resetMocks: false, + // Automatically reset mock state before every test + // resetMocks: false, - // Reset the module registry before running each individual test - // resetModules: false, + // Reset the module registry before running each individual test + // resetModules: false, - // A path to a custom resolver - // resolver: undefined, + // A path to a custom resolver + // resolver: undefined, - // Automatically restore mock state and implementation before every test - // restoreMocks: false, + // Automatically restore mock state and implementation before every test + // restoreMocks: false, - // The root directory that Jest should scan for tests and modules within - // rootDir: undefined, + // The root directory that Jest should scan for tests and modules within + // rootDir: undefined, - // A list of paths to directories that Jest should use to search for files in - // roots: [ - // "" - // ], + // A list of paths to directories that Jest should use to search for files in + // roots: [ + // "" + // ], - // Allows you to use a custom runner instead of Jest's default test runner - // runner: "jest-runner", + // Allows you to use a custom runner instead of Jest's default test runner + // runner: "jest-runner", - // The paths to modules that run some code to configure or set up the testing environment before each test - // setupFiles: [], + // The paths to modules that run some code to configure or set up the testing environment before each test + // setupFiles: [], - // A list of paths to modules that run some code to configure or set up the testing framework before each test - // setupFilesAfterEnv: [], + // A list of paths to modules that run some code to configure or set up the testing framework before each test + // setupFilesAfterEnv: [], - // The number of seconds after which a test is considered as slow and reported as such in the results. - // slowTestThreshold: 5, + // The number of seconds after which a test is considered as slow and reported as such in the results. + // slowTestThreshold: 5, - // A list of paths to snapshot serializer modules Jest should use for snapshot testing - // snapshotSerializers: [], + // A list of paths to snapshot serializer modules Jest should use for snapshot testing + // snapshotSerializers: [], - // The test environment that will be used for testing - testEnvironment: "node", + // The test environment that will be used for testing + testEnvironment: 'node', - // Options that will be passed to the testEnvironment - // testEnvironmentOptions: {}, + // Options that will be passed to the testEnvironment + // testEnvironmentOptions: {}, - // Adds a location field to test results - // testLocationInResults: false, + // Adds a location field to test results + // testLocationInResults: false, - // The glob patterns Jest uses to detect test files - testMatch: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[tj]s?(x)"], + // The glob patterns Jest uses to detect test files + testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'], - // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped - // testPathIgnorePatterns: [ - // "/node_modules/" - // ], + // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped + // testPathIgnorePatterns: [ + // "/node_modules/" + // ], - // The regexp pattern or array of patterns that Jest uses to detect test files - // testRegex: [], + // The regexp pattern or array of patterns that Jest uses to detect test files + // testRegex: [], - // This option allows the use of a custom results processor - // testResultsProcessor: undefined, + // This option allows the use of a custom results processor + // testResultsProcessor: undefined, - // This option allows use of a custom test runner - // testRunner: "jest-circus/runner", + // This option allows use of a custom test runner + // testRunner: "jest-circus/runner", - // A map from regular expressions to paths to transformers - transform: { - "\\.[jt]sx?$": ['@swc/jest'] - }, + // A map from regular expressions to paths to transformers + transform: { + '\\.[jt]sx?$': ['@swc/jest'], + }, - // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation - extensionsToTreatAsEsm: ['.ts', '.tsx'], - // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them - // unmockedModulePathPatterns: undefined, + // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation + extensionsToTreatAsEsm: ['.ts', '.tsx'], + // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them + // unmockedModulePathPatterns: undefined, - // Indicates whether each individual test should be reported during the run - // verbose: undefined, + // Indicates whether each individual test should be reported during the run + // verbose: undefined, - // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode - // watchPathIgnorePatterns: [], + // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode + // watchPathIgnorePatterns: [], - // Whether to use watchman for file crawling - // watchman: true + // Whether to use watchman for file crawling + // watchman: true }; diff --git a/package.json b/package.json index 62aeb47..0583436 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "prepublishOnly": "npm run build", "antlr4": "node ./scripts/antlr4.js", "build": "rm -rf dist && tsc", - "check-types": "tsc -p ./tsconfig.check.json", + "check-types": "tsc -p ./tsconfig.json && tsc -p ./test/tsconfig.json", "test": "NODE_OPTIONS=--max_old_space_size=4096 && jest", "release": "node ./scripts/release.js", "lint": "prettier --check '**/*.ts' --config ./.prettierrc", diff --git a/test/common/basicParser.test.ts b/test/common/basicParser.test.ts index 602cb9b..8781e71 100644 --- a/test/common/basicParser.test.ts +++ b/test/common/basicParser.test.ts @@ -1,4 +1,7 @@ -import { CommonTokenStream, ErrorListener, FlinkSQL, FlinkSqlLexer } from '../filters'; +import FlinkSQL from 'src/parser/flinksql'; +import { FlinkSqlLexer } from 'src/lib/flinksql/FlinkSqlLexer'; +import { ErrorListener } from 'src/parser/common/parseErrorListener'; +import { CommonTokenStream } from 'antlr4ts'; describe('BasicParser unit tests', () => { const flinkParser = new FlinkSQL(); diff --git a/test/filters/index.ts b/test/filters/index.ts deleted file mode 100644 index b3a9870..0000000 --- a/test/filters/index.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * All unit tests should import parser about from this file. - * In this way, the exports of dt-sql-parser in the entry file is guaranteed to be complete. - * - * 单测文件中有关 parser 的导入,都应该从这个文件中导入。 - * 通过这种方式,能保证 dt-sql-parser 的入口文件中的导出完整。 - * - * See this issue https://github.com/DTStack/dt-sql-parser/issues/236. - */ - -export * from '../../src'; - -/** - * Something required by unit test but dt-sql-parser'entry not. - * If you need to add an export to this file, - * consider whether it should be exported in src/index as well. - * - * 一些单测文件需要但是 dt-sql-parser的入口不需要的导出。 - * 如果你需要在这个文件中添加新的导出,请考虑它是否应该在 dt-sql-parser 的入口文件中导出。 - */ -export { CommonTokenStream } from 'antlr4ts'; - -export { ParseTreeWalker, ParseTreeListener } from 'antlr4ts/tree'; - -export { FlinkSqlLexer } from '../../src/lib/flinksql/FlinkSqlLexer'; -export { FlinkSqlParser } from '../../src/lib/flinksql/FlinkSqlParser'; -export * as FlinkSqlParserRuleContext from '../../src/lib/flinksql/FlinkSqlParser'; - -export { MySqlLexer } from '../../src/lib/mysql/MySqlLexer'; -export { MySqlParser } from '../../src/lib/mysql/MySqlParser'; -export * as MySqlParserRuleContext from '../../src/lib/mysql/MySqlParser'; - -export { HiveSqlLexer } from '../../src/lib/hive/HiveSqlLexer'; -export { HiveSqlParser } from '../../src/lib/hive/HiveSqlParser'; -export * as HiveSqlParserRuleContext from '../../src/lib/hive/HiveSqlParser'; - -export { PlSqlLexer } from '../../src/lib/plsql/PlSqlLexer'; -export { PlSqlParser } from '../../src/lib/plsql/PlSqlParser'; -export * as PlSqlParserRuleContext from '../../src/lib/plsql/PlSqlParser'; - -export { SparkSqlLexer } from '../../src/lib/spark/SparkSqlLexer'; -export { SparkSqlParser } from '../../src/lib/spark/SparkSqlParser'; -export * as SparkSQLParserRuleContext from '../../src/lib/spark/SparkSqlParser'; - -export { PostgreSQLLexer } from '../../src/lib/pgsql/PostgreSQLLexer'; -export { PostgreSQLParser } from '../../src/lib/pgsql/PostgreSQLParser'; -export * as PostgreSQLParserRuleContext from '../../src/lib/pgsql/PostgreSQLParser'; - -export { TrinoSqlLexer } from '../../src/lib/trinosql/TrinoSqlLexer'; -export { TrinoSqlParser } from '../../src/lib/trinosql/TrinoSqlParser'; -export * as TrinoSqlParserRuleContext from '../../src/lib/trinosql/TrinoSqlParser'; - -export { ImpalaSqlLexer } from '../../src/lib/impala/ImpalaSqlLexer'; -export { ImpalaSqlParser } from '../../src/lib/impala/ImpalaSqlParser'; -export * as ImpalaSqlParserRuleContext from '../../src/lib/impala/ImpalaSqlParser'; - -export { FlinkSqlSplitListener } from '../../src/parser/flinksql'; -export { MysqlSplitListener } from '../../src/parser/mysql'; -export { HiveSqlSplitListener } from '../../src/parser/hive'; -export { SparkSqlSplitListener } from '../../src/parser/spark'; -export { PgSqlSplitListener } from '../../src/parser/pgsql'; -export { TrinoSqlSplitListener } from '../../src/parser/trinosql'; -export { ImpalaSqlSplitListener } from '../../src/parser/impala'; diff --git a/test/parser/flinksql/benchmark/benchmark.md b/test/parser/flinksql/benchmark/benchmark.md index ca69082..3ac8164 100644 --- a/test/parser/flinksql/benchmark/benchmark.md +++ b/test/parser/flinksql/benchmark/benchmark.md @@ -1,12 +1,12 @@ # FlinkSQL Benchmark | Name | Rows | Times | Total Time(ms) | Average Time(ms) | | ---- | ---- | ---- | ---- | ---- | -| CreateTable | 100 | 1 | 3858.63 | 3858.63 | -| CreateTable | 1000 | 1 | 4845.70 | 4845.70 | -| CreateTable | 5000 | 1 | 14629.31 | 14629.31 | -| SelectTable | 100 | 1 | 3796.21 | 3796.21 | -| SelectTable | 1000 | 1 | 7207.75 | 7207.75 | -| SelectTable | 5000 | 1 | 26171.22 | 26171.22 | -| InsertTable | 100 | 1 | 57.62 | 57.62 | -| InsertTable | 1000 | 1 | 111.11 | 111.11 | -| InsertTable | 5000 | 1 | 2056.96 | 2056.96 | \ No newline at end of file +| CreateTable | 100 | 1 | 256.26 | 256.26 | +| CreateTable | 1000 | 1 | 343.14 | 343.14 | +| CreateTable | 5000 | 1 | 1816.20 | 1816.20 | +| SelectTable | 100 | 1 | 460.68 | 460.68 | +| SelectTable | 1000 | 1 | 1124.45 | 1124.45 | +| SelectTable | 5000 | 1 | 5212.31 | 5212.31 | +| InsertTable | 100 | 1 | 9.10 | 9.10 | +| InsertTable | 1000 | 1 | 41.80 | 41.80 | +| InsertTable | 5000 | 1 | 318.83 | 318.83 | \ No newline at end of file diff --git a/test/parser/flinksql/benchmark/main.test.ts b/test/parser/flinksql/benchmark/main.test.ts index 36dd92a..137a248 100644 --- a/test/parser/flinksql/benchmark/main.test.ts +++ b/test/parser/flinksql/benchmark/main.test.ts @@ -1,11 +1,11 @@ -import { FlinkSQL } from '../../../filters'; +import FlinkSQL from 'src/parser/flinksql'; import { readSQL, benchmark, getReportTableHeader, getReportTableRow, exportReportTable, -} from '../../../helper'; +} from 'test/helper'; const features = { selectTable: readSQL(__dirname, 'selectTable.sql'), diff --git a/test/parser/flinksql/errorStrategy.test.ts b/test/parser/flinksql/errorStrategy.test.ts index 0a48a51..c100753 100644 --- a/test/parser/flinksql/errorStrategy.test.ts +++ b/test/parser/flinksql/errorStrategy.test.ts @@ -1,4 +1,5 @@ -import { FlinkSQL, FlinkSqlSplitListener, FlinkSqlParserListener } from '../../filters'; +import FlinkSQL, { FlinkSqlSplitListener } from 'src/parser/flinksql'; +import { FlinkSqlParserListener } from 'src/lib/flinksql/FlinkSqlParserListener'; const validSQL1 = `INSERT INTO country_page_view VALUES ('Chinese', 'mumiao', 18), diff --git a/test/parser/flinksql/lexer.test.ts b/test/parser/flinksql/lexer.test.ts index 0c62cb7..70c1053 100644 --- a/test/parser/flinksql/lexer.test.ts +++ b/test/parser/flinksql/lexer.test.ts @@ -1,4 +1,4 @@ -import { FlinkSQL } from '../../filters'; +import FlinkSQL from 'src/parser/flinksql'; describe('FlinkSQL Lexer tests', () => { const parser = new FlinkSQL(); diff --git a/test/parser/flinksql/listener.test.ts b/test/parser/flinksql/listener.test.ts index eb65917..77cc94f 100644 --- a/test/parser/flinksql/listener.test.ts +++ b/test/parser/flinksql/listener.test.ts @@ -1,9 +1,7 @@ -import { - FlinkSQL, - FlinkSqlParserListener, - FlinkSqlParserRuleContext, - ParseTreeListener, -} from '../../filters'; +import { ParseTreeListener } from 'antlr4ts/tree/ParseTreeListener'; +import FlinkSQL from 'src/parser/flinksql'; +import { FlinkSqlParserListener } from 'src/lib/flinksql/FlinkSqlParserListener'; +import { TableExpressionContext } from 'src/lib/flinksql/FlinkSqlParser'; describe('Flink SQL Listener Tests', () => { const expectTableName = 'user1'; @@ -15,9 +13,7 @@ describe('Flink SQL Listener Tests', () => { test('Listener enterTableName', async () => { let result = ''; class MyListener implements FlinkSqlParserListener { - enterTableExpression = ( - ctx: FlinkSqlParserRuleContext.TableExpressionContext - ): void => { + enterTableExpression = (ctx: TableExpressionContext): void => { result = ctx.text.toLowerCase(); }; } diff --git a/test/parser/flinksql/suggestion/multipleStatement.test.ts b/test/parser/flinksql/suggestion/multipleStatement.test.ts index 6cf13d0..10e9c7b 100644 --- a/test/parser/flinksql/suggestion/multipleStatement.test.ts +++ b/test/parser/flinksql/suggestion/multipleStatement.test.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import path from 'path'; -import { CaretPosition, SyntaxContextType, FlinkSQL } from '../../../filters'; +import FlinkSQL from 'src/parser/flinksql'; +import { CaretPosition, SyntaxContextType } from 'src/parser/common/basic-parser-types'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'multipleStatement.sql'), diff --git a/test/parser/flinksql/suggestion/syntaxSuggestion.test.ts b/test/parser/flinksql/suggestion/syntaxSuggestion.test.ts index 3c52664..5188677 100644 --- a/test/parser/flinksql/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/flinksql/suggestion/syntaxSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { CaretPosition, SyntaxContextType, FlinkSQL } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { CaretPosition, SyntaxContextType } from 'src/parser/common/basic-parser-types'; +import { commentOtherLine } from 'test/helper'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'), diff --git a/test/parser/flinksql/suggestion/tokenSuggestion.test.ts b/test/parser/flinksql/suggestion/tokenSuggestion.test.ts index 2b99eeb..c8a8642 100644 --- a/test/parser/flinksql/suggestion/tokenSuggestion.test.ts +++ b/test/parser/flinksql/suggestion/tokenSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { FlinkSQL, CaretPosition } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { CaretPosition } from 'src/parser/common/basic-parser-types'; +import { commentOtherLine } from 'test/helper'; const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8'); diff --git a/test/parser/flinksql/syntax/alterStatement.test.ts b/test/parser/flinksql/syntax/alterStatement.test.ts index f3e5e76..5e9c67c 100644 --- a/test/parser/flinksql/syntax/alterStatement.test.ts +++ b/test/parser/flinksql/syntax/alterStatement.test.ts @@ -1,5 +1,5 @@ -import { FlinkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { readSQL } from 'test/helper'; const features = { table: readSQL(__dirname, 'alterTable.sql'), diff --git a/test/parser/flinksql/syntax/choreStatement.test.ts b/test/parser/flinksql/syntax/choreStatement.test.ts index 72c5f45..62f615a 100644 --- a/test/parser/flinksql/syntax/choreStatement.test.ts +++ b/test/parser/flinksql/syntax/choreStatement.test.ts @@ -1,5 +1,5 @@ -import { FlinkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { readSQL } from 'test/helper'; // 综合测试的 sql 不做切割 const features = { diff --git a/test/parser/flinksql/syntax/commentStatement.test.ts b/test/parser/flinksql/syntax/commentStatement.test.ts index e1424ef..95d0fdb 100644 --- a/test/parser/flinksql/syntax/commentStatement.test.ts +++ b/test/parser/flinksql/syntax/commentStatement.test.ts @@ -1,6 +1,6 @@ import fs from 'fs'; import path from 'path'; -import { FlinkSQL } from '../../../filters'; +import FlinkSQL from 'src/parser/flinksql'; // 注释 sql 不做切割 const features = { diff --git a/test/parser/flinksql/syntax/comprehensive.test.ts b/test/parser/flinksql/syntax/comprehensive.test.ts index 06388f2..b8aac3e 100644 --- a/test/parser/flinksql/syntax/comprehensive.test.ts +++ b/test/parser/flinksql/syntax/comprehensive.test.ts @@ -1,6 +1,6 @@ import fs from 'fs'; import path from 'path'; -import { FlinkSQL } from '../../../filters'; +import FlinkSQL from 'src/parser/flinksql'; // 综合测试的 sql 不做切割 const features = { diff --git a/test/parser/flinksql/syntax/createStatement.test.ts b/test/parser/flinksql/syntax/createStatement.test.ts index 8024a64..7fe2bbd 100644 --- a/test/parser/flinksql/syntax/createStatement.test.ts +++ b/test/parser/flinksql/syntax/createStatement.test.ts @@ -1,5 +1,5 @@ -import { FlinkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { readSQL } from 'test/helper'; const parser = new FlinkSQL(); diff --git a/test/parser/flinksql/syntax/describeStatement.test.ts b/test/parser/flinksql/syntax/describeStatement.test.ts index 4550e07..cf244a5 100644 --- a/test/parser/flinksql/syntax/describeStatement.test.ts +++ b/test/parser/flinksql/syntax/describeStatement.test.ts @@ -1,5 +1,5 @@ -import { FlinkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { readSQL } from 'test/helper'; const features = { describes: readSQL(__dirname, 'describe.sql'), diff --git a/test/parser/flinksql/syntax/dropStatement.test.ts b/test/parser/flinksql/syntax/dropStatement.test.ts index ee2dd00..0d26730 100644 --- a/test/parser/flinksql/syntax/dropStatement.test.ts +++ b/test/parser/flinksql/syntax/dropStatement.test.ts @@ -1,5 +1,5 @@ -import { FlinkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { readSQL } from 'test/helper'; const features = { table: readSQL(__dirname, 'dropTable.sql'), diff --git a/test/parser/flinksql/syntax/dtAddFileStatement.test.ts b/test/parser/flinksql/syntax/dtAddFileStatement.test.ts index 57a4acb..27625d9 100644 --- a/test/parser/flinksql/syntax/dtAddFileStatement.test.ts +++ b/test/parser/flinksql/syntax/dtAddFileStatement.test.ts @@ -1,5 +1,5 @@ -import { FlinkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { readSQL } from 'test/helper'; const features = { dtAddFiles: readSQL(__dirname, 'dtAddFile.sql'), diff --git a/test/parser/flinksql/syntax/explainStatement.test.ts b/test/parser/flinksql/syntax/explainStatement.test.ts index e7b9e82..9c4172b 100644 --- a/test/parser/flinksql/syntax/explainStatement.test.ts +++ b/test/parser/flinksql/syntax/explainStatement.test.ts @@ -1,5 +1,5 @@ -import { FlinkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { readSQL } from 'test/helper'; const features = { explains: readSQL(__dirname, 'explain.sql'), diff --git a/test/parser/flinksql/syntax/expressionStatement.test.ts b/test/parser/flinksql/syntax/expressionStatement.test.ts index a12d103..0d12313 100644 --- a/test/parser/flinksql/syntax/expressionStatement.test.ts +++ b/test/parser/flinksql/syntax/expressionStatement.test.ts @@ -1,5 +1,5 @@ -import { FlinkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { readSQL } from 'test/helper'; const features = { expression: readSQL(__dirname, 'expression.sql'), diff --git a/test/parser/flinksql/syntax/insertStatement.test.ts b/test/parser/flinksql/syntax/insertStatement.test.ts index bd8e1fb..9d69493 100644 --- a/test/parser/flinksql/syntax/insertStatement.test.ts +++ b/test/parser/flinksql/syntax/insertStatement.test.ts @@ -1,5 +1,5 @@ -import { FlinkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { readSQL } from 'test/helper'; const parser = new FlinkSQL(); diff --git a/test/parser/flinksql/syntax/selectStatement.test.ts b/test/parser/flinksql/syntax/selectStatement.test.ts index d495132..bcbe686 100644 --- a/test/parser/flinksql/syntax/selectStatement.test.ts +++ b/test/parser/flinksql/syntax/selectStatement.test.ts @@ -1,5 +1,5 @@ -import { FlinkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { readSQL } from 'test/helper'; const parser = new FlinkSQL(); diff --git a/test/parser/flinksql/syntax/showStatement.test.ts b/test/parser/flinksql/syntax/showStatement.test.ts index 64c8138..5900827 100644 --- a/test/parser/flinksql/syntax/showStatement.test.ts +++ b/test/parser/flinksql/syntax/showStatement.test.ts @@ -1,5 +1,5 @@ -import { FlinkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { readSQL } from 'test/helper'; const features = { shows: readSQL(__dirname, 'show.sql'), diff --git a/test/parser/flinksql/syntax/useStatement.test.ts b/test/parser/flinksql/syntax/useStatement.test.ts index 7283b94..83f4f97 100644 --- a/test/parser/flinksql/syntax/useStatement.test.ts +++ b/test/parser/flinksql/syntax/useStatement.test.ts @@ -1,5 +1,5 @@ -import { FlinkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import FlinkSQL from 'src/parser/flinksql'; +import { readSQL } from 'test/helper'; const features = { uses: readSQL(__dirname, 'use.sql'), diff --git a/test/parser/flinksql/validateInvalidSql.test.ts b/test/parser/flinksql/validateInvalidSql.test.ts index ab18044..00dd8e6 100644 --- a/test/parser/flinksql/validateInvalidSql.test.ts +++ b/test/parser/flinksql/validateInvalidSql.test.ts @@ -1,4 +1,4 @@ -import { FlinkSQL } from '../../filters'; +import FlinkSQL from 'src/parser/flinksql'; const randomText = `dhsdansdnkla ndjnsla ndnalks`; const unCompleteSQL = `CREATE TABLE`; diff --git a/test/parser/flinksql/visitor.test.ts b/test/parser/flinksql/visitor.test.ts index 1894b2b..6e2e80d 100644 --- a/test/parser/flinksql/visitor.test.ts +++ b/test/parser/flinksql/visitor.test.ts @@ -1,4 +1,6 @@ -import { FlinkSQL, AbstractParseTreeVisitor, FlinkSqlParserVisitor } from '../../filters'; +import FlinkSQL from 'src/parser/flinksql'; +import { FlinkSqlParserVisitor } from 'src/lib/flinksql/FlinkSqlParserVisitor'; +import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor'; describe('Flink SQL Visitor Tests', () => { const expectTableName = 'user1'; diff --git a/test/parser/hive/errorStrategy.test.ts b/test/parser/hive/errorStrategy.test.ts index 6dbbc78..7867e87 100644 --- a/test/parser/hive/errorStrategy.test.ts +++ b/test/parser/hive/errorStrategy.test.ts @@ -1,4 +1,5 @@ -import { HiveSQL, HiveSqlSplitListener, HiveSqlParserListener } from '../../filters'; +import HiveSQL, { HiveSqlSplitListener } from 'src/parser/hive'; +import { HiveSqlParserListener } from 'src/lib'; const validSQL1 = `INSERT INTO country_page_view VALUES ('Chinese', 'mumiao', 18), diff --git a/test/parser/hive/lexer.test.ts b/test/parser/hive/lexer.test.ts index 74a8553..08b1ac1 100644 --- a/test/parser/hive/lexer.test.ts +++ b/test/parser/hive/lexer.test.ts @@ -1,4 +1,4 @@ -import { HiveSQL } from '../../filters'; +import HiveSQL from 'src/parser/hive'; describe('HiveSQL Lexer tests', () => { const parser = new HiveSQL(); diff --git a/test/parser/hive/listener.test.ts b/test/parser/hive/listener.test.ts index d309309..1fef6ce 100644 --- a/test/parser/hive/listener.test.ts +++ b/test/parser/hive/listener.test.ts @@ -1,5 +1,7 @@ -import { ParseTreeListener } from 'antlr4ts/tree'; -import { HiveSQL, HiveSqlParserListener, HiveSqlParserRuleContext } from '../../filters'; +import { ParseTreeListener } from 'antlr4ts/tree/ParseTreeListener'; +import HiveSQL from 'src/parser/hive'; +import { ProgramContext } from 'src/lib/hive/HiveSqlParser'; +import { HiveSqlParserListener } from 'src/lib/hive/HiveSqlParserListener'; describe('HiveSQL Listener Tests', () => { const parser = new HiveSQL(); @@ -16,10 +18,7 @@ describe('HiveSQL Listener Tests', () => { } const listenTableName = new MyListener(); - await parser.listen( - listenTableName as ParseTreeListener, - parseTree as HiveSqlParserRuleContext.ProgramContext - ); + await parser.listen(listenTableName as ParseTreeListener, parseTree as ProgramContext); expect(result).toBe(expectTableName.toUpperCase()); }); test('Listener enterCreateTable', async () => { @@ -33,10 +32,7 @@ describe('HiveSQL Listener Tests', () => { } const listenTableName = new MyListener(); - await parser.listen( - listenTableName as ParseTreeListener, - parseTree as HiveSqlParserRuleContext.ProgramContext - ); + await parser.listen(listenTableName as ParseTreeListener, parseTree as ProgramContext); expect(result).toBe('DROPTABLETABLE_NAME'); }); diff --git a/test/parser/hive/suggestion/multipleStatement.test.ts b/test/parser/hive/suggestion/multipleStatement.test.ts index 97784f6..316670d 100644 --- a/test/parser/hive/suggestion/multipleStatement.test.ts +++ b/test/parser/hive/suggestion/multipleStatement.test.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import path from 'path'; -import { CaretPosition, SyntaxContextType, HiveSQL } from '../../../filters'; +import HiveSQL from 'src/parser/hive'; +import { CaretPosition, SyntaxContextType } from 'src/parser/common/basic-parser-types'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'multipleStatement.sql'), diff --git a/test/parser/hive/suggestion/syntaxSuggestion.test.ts b/test/parser/hive/suggestion/syntaxSuggestion.test.ts index 0b5480b..d5b2f78 100644 --- a/test/parser/hive/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/hive/suggestion/syntaxSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { CaretPosition, SyntaxContextType, HiveSQL } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { CaretPosition, SyntaxContextType } from 'src/parser/common/basic-parser-types'; +import { commentOtherLine } from 'test/helper'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'), diff --git a/test/parser/hive/suggestion/tokenSuggestion.test.ts b/test/parser/hive/suggestion/tokenSuggestion.test.ts index fa4b6ce..33d2dbc 100644 --- a/test/parser/hive/suggestion/tokenSuggestion.test.ts +++ b/test/parser/hive/suggestion/tokenSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { CaretPosition, HiveSQL } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import { commentOtherLine } from 'test/helper'; +import HiveSQL from 'src/parser/hive'; +import { CaretPosition } from 'src/parser/common/basic-parser-types'; const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8'); diff --git a/test/parser/hive/syntax/abortStatement.test.ts b/test/parser/hive/syntax/abortStatement.test.ts index 6cdaef9..94f4ea9 100644 --- a/test/parser/hive/syntax/abortStatement.test.ts +++ b/test/parser/hive/syntax/abortStatement.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/alterStatement.test.ts b/test/parser/hive/syntax/alterStatement.test.ts index 666402b..71d33bc 100644 --- a/test/parser/hive/syntax/alterStatement.test.ts +++ b/test/parser/hive/syntax/alterStatement.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/authorizationStatement.test.ts b/test/parser/hive/syntax/authorizationStatement.test.ts index 8685c9b..2b3e5f6 100644 --- a/test/parser/hive/syntax/authorizationStatement.test.ts +++ b/test/parser/hive/syntax/authorizationStatement.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/createStatement.test.ts b/test/parser/hive/syntax/createStatement.test.ts index 17ac2ae..8d3b39e 100644 --- a/test/parser/hive/syntax/createStatement.test.ts +++ b/test/parser/hive/syntax/createStatement.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/dataTypesStatement.test.ts b/test/parser/hive/syntax/dataTypesStatement.test.ts index 60a8cc0..830cc33 100644 --- a/test/parser/hive/syntax/dataTypesStatement.test.ts +++ b/test/parser/hive/syntax/dataTypesStatement.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/delete.test.ts b/test/parser/hive/syntax/delete.test.ts index 5409753..32ec9dc 100644 --- a/test/parser/hive/syntax/delete.test.ts +++ b/test/parser/hive/syntax/delete.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/describeStatement.test.ts b/test/parser/hive/syntax/describeStatement.test.ts index efa77cd..d195fbc 100644 --- a/test/parser/hive/syntax/describeStatement.test.ts +++ b/test/parser/hive/syntax/describeStatement.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/dropStatement.test.ts b/test/parser/hive/syntax/dropStatement.test.ts index 6ede21d..2215850 100644 --- a/test/parser/hive/syntax/dropStatement.test.ts +++ b/test/parser/hive/syntax/dropStatement.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/exportStatement.test.ts b/test/parser/hive/syntax/exportStatement.test.ts index 7903993..c578662 100644 --- a/test/parser/hive/syntax/exportStatement.test.ts +++ b/test/parser/hive/syntax/exportStatement.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const features = { exports: readSQL(__dirname, 'export.sql'), diff --git a/test/parser/hive/syntax/importStatement.test.ts b/test/parser/hive/syntax/importStatement.test.ts index 9921b57..feea185 100644 --- a/test/parser/hive/syntax/importStatement.test.ts +++ b/test/parser/hive/syntax/importStatement.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const features = { imports: readSQL(__dirname, 'import.sql'), diff --git a/test/parser/hive/syntax/insertStatement.test.ts b/test/parser/hive/syntax/insertStatement.test.ts index dff13d9..1fc917b 100644 --- a/test/parser/hive/syntax/insertStatement.test.ts +++ b/test/parser/hive/syntax/insertStatement.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/loadStatement.test.ts b/test/parser/hive/syntax/loadStatement.test.ts index 0cb0457..d13acfc 100644 --- a/test/parser/hive/syntax/loadStatement.test.ts +++ b/test/parser/hive/syntax/loadStatement.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/merge.test.ts b/test/parser/hive/syntax/merge.test.ts index 7f6af29..82434b0 100644 --- a/test/parser/hive/syntax/merge.test.ts +++ b/test/parser/hive/syntax/merge.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/selectStatement.test.ts b/test/parser/hive/syntax/selectStatement.test.ts index 27fb5ba..c691d63 100644 --- a/test/parser/hive/syntax/selectStatement.test.ts +++ b/test/parser/hive/syntax/selectStatement.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/showStatement.test.ts b/test/parser/hive/syntax/showStatement.test.ts index 375e76e..7bb826d 100644 --- a/test/parser/hive/syntax/showStatement.test.ts +++ b/test/parser/hive/syntax/showStatement.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/syntax/update.test.ts b/test/parser/hive/syntax/update.test.ts index 1ad2a75..a12a573 100644 --- a/test/parser/hive/syntax/update.test.ts +++ b/test/parser/hive/syntax/update.test.ts @@ -1,5 +1,5 @@ -import { HiveSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import HiveSQL from 'src/parser/hive'; +import { readSQL } from 'test/helper'; const parser = new HiveSQL(); diff --git a/test/parser/hive/validateInvalidSql.test.ts b/test/parser/hive/validateInvalidSql.test.ts index b5da951..5dcdd01 100644 --- a/test/parser/hive/validateInvalidSql.test.ts +++ b/test/parser/hive/validateInvalidSql.test.ts @@ -1,4 +1,4 @@ -import { HiveSQL } from '../../filters'; +import HiveSQL from 'src/parser/hive'; const randomText = `dhsdansdnkla ndjnsla ndnalks`; const unCompleteSQL = `CREATE TABLE`; diff --git a/test/parser/hive/visitor.test.ts b/test/parser/hive/visitor.test.ts index d20812a..28f5576 100644 --- a/test/parser/hive/visitor.test.ts +++ b/test/parser/hive/visitor.test.ts @@ -1,9 +1,8 @@ -import { - HiveSQL, - HiveSqlParserVisitor, - AbstractParseTreeVisitor, - HiveSqlParserRuleContext, -} from '../../filters'; +import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor'; + +import HiveSQL from 'src/parser/hive'; +import { HiveSqlParserVisitor } from 'src/lib/hive/HiveSqlParserVisitor'; +import { ProgramContext } from 'src/lib/hive/HiveSqlParser'; describe('HiveSQL Visitor Tests', () => { const expectTableName = 'dm_gis.dlv_addr_tc_count'; @@ -27,7 +26,7 @@ describe('HiveSQL Visitor Tests', () => { } const visitor = new MyVisitor(); - visitor.visit(parseTree as HiveSqlParserRuleContext.ProgramContext); + visitor.visit(parseTree as ProgramContext); expect(result).toBe(expectTableName); }); diff --git a/test/parser/impala/errorStrategy.test.ts b/test/parser/impala/errorStrategy.test.ts index 27fa9ee..828368d 100644 --- a/test/parser/impala/errorStrategy.test.ts +++ b/test/parser/impala/errorStrategy.test.ts @@ -1,4 +1,5 @@ -import { ImpalaSQL, ImpalaSqlSplitListener, ImpalaSqlParserListener } from '../../filters'; +import ImpalaSQL, { ImpalaSqlSplitListener } from 'src/parser/impala'; +import { ImpalaSqlParserListener } from 'src/lib/impala/ImpalaSqlParserListener'; const validSQL1 = `INSERT INTO country_page_view VALUES ('Chinese', 'mumiao', 18), diff --git a/test/parser/impala/lexer.test.ts b/test/parser/impala/lexer.test.ts index 37a6ea9..93bbe3d 100644 --- a/test/parser/impala/lexer.test.ts +++ b/test/parser/impala/lexer.test.ts @@ -1,4 +1,4 @@ -import { ImpalaSQL } from '../../filters'; +import ImpalaSQL from 'src/parser/impala'; describe('ImpalaSQL Lexer tests', () => { const parser = new ImpalaSQL(); diff --git a/test/parser/impala/listener.test.ts b/test/parser/impala/listener.test.ts index 51b0e28..9df599e 100644 --- a/test/parser/impala/listener.test.ts +++ b/test/parser/impala/listener.test.ts @@ -1,4 +1,6 @@ -import { ImpalaSQL, ImpalaSqlParserListener, ParseTreeListener } from '../../filters'; +import ImpalaSQL from 'src/parser/impala'; +import { ImpalaSqlParserListener } from 'src/lib/impala/ImpalaSqlParserListener'; +import { ParseTreeListener } from 'antlr4ts/tree/ParseTreeListener'; describe('impala SQL Listener Tests', () => { const expectTableName = 'user1'; diff --git a/test/parser/impala/suggestion/multipleStatement.test.ts b/test/parser/impala/suggestion/multipleStatement.test.ts index c0d6cb2..eb5c318 100644 --- a/test/parser/impala/suggestion/multipleStatement.test.ts +++ b/test/parser/impala/suggestion/multipleStatement.test.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import path from 'path'; -import { ImpalaSQL, CaretPosition, SyntaxContextType } from '../../../filters'; +import ImpalaSQL from 'src/parser/impala'; +import { CaretPosition, SyntaxContextType } from 'src/parser/common/basic-parser-types'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'multipleStatement.sql'), diff --git a/test/parser/impala/suggestion/syntaxSuggestion.test.ts b/test/parser/impala/suggestion/syntaxSuggestion.test.ts index cce11fd..a6b8f02 100644 --- a/test/parser/impala/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/impala/suggestion/syntaxSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { ImpalaSQL, CaretPosition, SyntaxContextType } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import ImpalaSQL from 'src/parser/impala'; +import { CaretPosition, SyntaxContextType } from 'src/parser/common/basic-parser-types'; +import { commentOtherLine } from 'test/helper'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'), diff --git a/test/parser/impala/suggestion/tokenSuggestion.test.ts b/test/parser/impala/suggestion/tokenSuggestion.test.ts index 540d82f..27be51b 100644 --- a/test/parser/impala/suggestion/tokenSuggestion.test.ts +++ b/test/parser/impala/suggestion/tokenSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { ImpalaSQL, CaretPosition } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import ImpalaSQL from 'src/parser/impala'; +import { CaretPosition } from 'src/parser/common/basic-parser-types'; +import { commentOtherLine } from 'test/helper'; const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8'); diff --git a/test/parser/impala/syntax/alterStatement.test.ts b/test/parser/impala/syntax/alterStatement.test.ts index c894050..95c1910 100644 --- a/test/parser/impala/syntax/alterStatement.test.ts +++ b/test/parser/impala/syntax/alterStatement.test.ts @@ -1,5 +1,5 @@ -import { ImpalaSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import ImpalaSQL from 'src/parser/impala'; +import { readSQL } from 'test/helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/creataStatement.test.ts b/test/parser/impala/syntax/creataStatement.test.ts index bfdf7ac..82acd1d 100644 --- a/test/parser/impala/syntax/creataStatement.test.ts +++ b/test/parser/impala/syntax/creataStatement.test.ts @@ -1,5 +1,5 @@ -import { ImpalaSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import ImpalaSQL from 'src/parser/impala'; +import { readSQL } from 'test/helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/delete.test.ts b/test/parser/impala/syntax/delete.test.ts index 070c442..6e4ff43 100644 --- a/test/parser/impala/syntax/delete.test.ts +++ b/test/parser/impala/syntax/delete.test.ts @@ -1,5 +1,5 @@ -import { ImpalaSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import ImpalaSQL from 'src/parser/impala'; +import { readSQL } from 'test/helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/dropStatement.test.ts b/test/parser/impala/syntax/dropStatement.test.ts index 321a984..07cd499 100644 --- a/test/parser/impala/syntax/dropStatement.test.ts +++ b/test/parser/impala/syntax/dropStatement.test.ts @@ -1,5 +1,5 @@ -import { ImpalaSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import ImpalaSQL from 'src/parser/impala'; +import { readSQL } from 'test/helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/insert.test.ts b/test/parser/impala/syntax/insert.test.ts index a2d18ee..4bec7a0 100644 --- a/test/parser/impala/syntax/insert.test.ts +++ b/test/parser/impala/syntax/insert.test.ts @@ -1,5 +1,5 @@ -import { ImpalaSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import ImpalaSQL from 'src/parser/impala'; +import { readSQL } from 'test/helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/otherStatement.test.ts b/test/parser/impala/syntax/otherStatement.test.ts index 793da88..9eea782 100644 --- a/test/parser/impala/syntax/otherStatement.test.ts +++ b/test/parser/impala/syntax/otherStatement.test.ts @@ -1,5 +1,5 @@ -import { ImpalaSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import ImpalaSQL from 'src/parser/impala'; +import { readSQL } from 'test/helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/refresh.test.ts b/test/parser/impala/syntax/refresh.test.ts index fd351fc..6a0c874 100644 --- a/test/parser/impala/syntax/refresh.test.ts +++ b/test/parser/impala/syntax/refresh.test.ts @@ -1,5 +1,5 @@ -import { ImpalaSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import ImpalaSQL from 'src/parser/impala'; +import { readSQL } from 'test/helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/select.test.ts b/test/parser/impala/syntax/select.test.ts index 94decb5..48cdf21 100644 --- a/test/parser/impala/syntax/select.test.ts +++ b/test/parser/impala/syntax/select.test.ts @@ -1,5 +1,5 @@ -import { ImpalaSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import ImpalaSQL from 'src/parser/impala'; +import { readSQL } from 'test/helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/show.test.ts b/test/parser/impala/syntax/show.test.ts index 81c179a..5997aec 100644 --- a/test/parser/impala/syntax/show.test.ts +++ b/test/parser/impala/syntax/show.test.ts @@ -1,5 +1,5 @@ -import { ImpalaSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import ImpalaSQL from 'src/parser/impala'; +import { readSQL } from 'test/helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/update.test.ts b/test/parser/impala/syntax/update.test.ts index 78c757f..9768dc6 100644 --- a/test/parser/impala/syntax/update.test.ts +++ b/test/parser/impala/syntax/update.test.ts @@ -1,5 +1,5 @@ -import { ImpalaSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import ImpalaSQL from 'src/parser/impala'; +import { readSQL } from 'test/helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/syntax/upsert.test.ts b/test/parser/impala/syntax/upsert.test.ts index 0627701..8c583d6 100644 --- a/test/parser/impala/syntax/upsert.test.ts +++ b/test/parser/impala/syntax/upsert.test.ts @@ -1,5 +1,5 @@ -import { ImpalaSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import ImpalaSQL from 'src/parser/impala'; +import { readSQL } from 'test/helper'; const parser = new ImpalaSQL(); diff --git a/test/parser/impala/validateInvalidSql.test.ts b/test/parser/impala/validateInvalidSql.test.ts index 179fc78..ab2cdb7 100644 --- a/test/parser/impala/validateInvalidSql.test.ts +++ b/test/parser/impala/validateInvalidSql.test.ts @@ -1,4 +1,4 @@ -import { ImpalaSQL } from '../../filters'; +import ImpalaSQL from 'src/parser/impala'; const randomText = `dhsdansdnkla ndjnsla ndnalks`; const unCompleteSQL = `CREATE TABLE`; diff --git a/test/parser/impala/visitor.test.ts b/test/parser/impala/visitor.test.ts index 28576d1..a90de94 100644 --- a/test/parser/impala/visitor.test.ts +++ b/test/parser/impala/visitor.test.ts @@ -1,4 +1,6 @@ -import { ImpalaSQL, ImpalaSqlParserVisitor, AbstractParseTreeVisitor } from '../../filters'; +import ImpalaSQL from 'src/parser/impala'; +import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor'; +import { ImpalaSqlParserVisitor } from 'src/lib/impala/ImpalaSqlParserVisitor'; describe('impala SQL Visitor Tests', () => { const expectTableName = 'user1'; diff --git a/test/parser/mysql/errorStrategy.test.ts b/test/parser/mysql/errorStrategy.test.ts index d5c0d9f..3e3f23c 100644 --- a/test/parser/mysql/errorStrategy.test.ts +++ b/test/parser/mysql/errorStrategy.test.ts @@ -1,5 +1,5 @@ -import { MySQL } from '../../filters'; -import { MysqlSplitListener, MySqlParserListener } from '../../filters'; +import MySQL, { MysqlSplitListener } from 'src/parser/mysql'; +import { MySqlParserListener } from 'src/lib/mysql/MySqlParserListener'; const validSQL1 = `INSERT INTO country_page_view VALUES ('Chinese', 'mumiao', 18), diff --git a/test/parser/mysql/lexer.test.ts b/test/parser/mysql/lexer.test.ts index 3bea670..64b6249 100644 --- a/test/parser/mysql/lexer.test.ts +++ b/test/parser/mysql/lexer.test.ts @@ -1,4 +1,4 @@ -import { MySQL } from '../../filters'; +import MySQL from 'src/parser/mysql'; describe('MySQL Lexer tests', () => { const parser = new MySQL(); diff --git a/test/parser/mysql/listener.test.ts b/test/parser/mysql/listener.test.ts index 922d921..c1eb134 100644 --- a/test/parser/mysql/listener.test.ts +++ b/test/parser/mysql/listener.test.ts @@ -1,5 +1,6 @@ -import { MySQL } from '../../filters'; -import { MySqlParserListener, ParseTreeListener } from '../../filters'; +import MySQL from 'src/parser/mysql'; +import { MySqlParserListener } from 'src/lib/mysql/MySqlParserListener'; +import { ParseTreeListener } from 'antlr4ts/tree/ParseTreeListener'; describe('MySQL Listener Tests', () => { const expectTableName = 'user1'; diff --git a/test/parser/mysql/suggestion/multipleStatement.test.ts b/test/parser/mysql/suggestion/multipleStatement.test.ts index ae53d46..405eed5 100644 --- a/test/parser/mysql/suggestion/multipleStatement.test.ts +++ b/test/parser/mysql/suggestion/multipleStatement.test.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import path from 'path'; -import { MySQL, CaretPosition, SyntaxContextType } from '../../../filters'; +import MySQL from 'src/parser/mysql'; +import { CaretPosition, SyntaxContextType } from 'src/parser/common/basic-parser-types'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'multipleStatement.sql'), diff --git a/test/parser/mysql/suggestion/syntaxSuggestion.test.ts b/test/parser/mysql/suggestion/syntaxSuggestion.test.ts index 3b01d80..7d30bab 100644 --- a/test/parser/mysql/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/mysql/suggestion/syntaxSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { MySQL, CaretPosition, SyntaxContextType } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import MySQL from 'src/parser/mysql'; +import { SyntaxContextType, CaretPosition } from 'src/parser/common/basic-parser-types'; +import { commentOtherLine } from 'test/helper'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'), diff --git a/test/parser/mysql/suggestion/tokenSuggestion.test.ts b/test/parser/mysql/suggestion/tokenSuggestion.test.ts index 70d5010..7b576e5 100644 --- a/test/parser/mysql/suggestion/tokenSuggestion.test.ts +++ b/test/parser/mysql/suggestion/tokenSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { MySQL, CaretPosition } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import MySQL from 'src/parser/mysql'; +import { CaretPosition } from 'src/parser/common/basic-parser-types'; +import { commentOtherLine } from 'test/helper'; const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8'); diff --git a/test/parser/mysql/syntax.test.ts b/test/parser/mysql/syntax.test.ts index 6309c0b..b8d45d7 100644 --- a/test/parser/mysql/syntax.test.ts +++ b/test/parser/mysql/syntax.test.ts @@ -1,4 +1,4 @@ -import { MySQL } from '../../filters'; +import MySQL from 'src/parser/mysql'; describe('MySQL Syntax Tests', () => { const parser = new MySQL(); diff --git a/test/parser/mysql/syntax/administration.test.ts b/test/parser/mysql/syntax/administration.test.ts index 1adfe7b..bb64f9d 100644 --- a/test/parser/mysql/syntax/administration.test.ts +++ b/test/parser/mysql/syntax/administration.test.ts @@ -1,5 +1,5 @@ -import { MySQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import MySQL from 'src/parser/mysql'; +import { readSQL } from 'test/helper'; const parser = new MySQL(); diff --git a/test/parser/mysql/syntax/ddl.test.ts b/test/parser/mysql/syntax/ddl.test.ts index bdde0b5..88fabdb 100644 --- a/test/parser/mysql/syntax/ddl.test.ts +++ b/test/parser/mysql/syntax/ddl.test.ts @@ -1,5 +1,5 @@ -import { MySQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import MySQL from 'src/parser/mysql'; +import { readSQL } from 'test/helper'; const parser = new MySQL(); diff --git a/test/parser/mysql/syntax/dml.test.ts b/test/parser/mysql/syntax/dml.test.ts index e3b2f9f..6a51b40 100644 --- a/test/parser/mysql/syntax/dml.test.ts +++ b/test/parser/mysql/syntax/dml.test.ts @@ -1,5 +1,5 @@ -import { MySQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import MySQL from 'src/parser/mysql'; +import { readSQL } from 'test/helper'; const parser = new MySQL(); diff --git a/test/parser/mysql/syntax/other.test.ts b/test/parser/mysql/syntax/other.test.ts index d635706..d4e240d 100644 --- a/test/parser/mysql/syntax/other.test.ts +++ b/test/parser/mysql/syntax/other.test.ts @@ -1,5 +1,5 @@ -import { MySQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import MySQL from 'src/parser/mysql'; +import { readSQL } from 'test/helper'; const parser = new MySQL(); diff --git a/test/parser/mysql/validateInvalidSql.test.ts b/test/parser/mysql/validateInvalidSql.test.ts index 14561a1..2f1e4e8 100644 --- a/test/parser/mysql/validateInvalidSql.test.ts +++ b/test/parser/mysql/validateInvalidSql.test.ts @@ -1,4 +1,4 @@ -import { MySQL } from '../../filters'; +import MySQL from 'src/parser/mysql'; const randomText = `dhsdansdnkla ndjnsla ndnalks`; const unCompleteSQL = `CREATE TABLE`; diff --git a/test/parser/mysql/visitor.test.ts b/test/parser/mysql/visitor.test.ts index e2f6fb9..0a81da6 100644 --- a/test/parser/mysql/visitor.test.ts +++ b/test/parser/mysql/visitor.test.ts @@ -1,4 +1,6 @@ -import { MySQL, MySqlParserVisitor, AbstractParseTreeVisitor } from '../../filters'; +import MySQL from 'src/parser/mysql'; +import { MySqlParserVisitor } from 'src/lib/mysql/MySqlParserVisitor'; +import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor'; describe('MySQL Visitor Tests', () => { const expectTableName = 'user1'; diff --git a/test/parser/pgsql/errorStrategy.test.ts b/test/parser/pgsql/errorStrategy.test.ts index 0db9878..288b0ef 100644 --- a/test/parser/pgsql/errorStrategy.test.ts +++ b/test/parser/pgsql/errorStrategy.test.ts @@ -1,4 +1,5 @@ -import { PostgresSQL, PgSqlSplitListener, PostgreSQLParserListener } from '../../filters'; +import PostgresSQL, { PgSqlSplitListener } from 'src/parser/pgsql'; +import { PostgreSQLParserListener } from 'src/lib/pgsql/PostgreSQLParserListener'; const validSQL1 = `INSERT INTO country_page_view VALUES ('Chinese', 'mumiao', 18), diff --git a/test/parser/pgsql/lexer.test.ts b/test/parser/pgsql/lexer.test.ts index 71b3ef0..ff22a8c 100644 --- a/test/parser/pgsql/lexer.test.ts +++ b/test/parser/pgsql/lexer.test.ts @@ -1,4 +1,4 @@ -import { PostgresSQL } from '../../filters'; +import PostgresSQL from 'src/parser/pgsql'; describe('PostgresSQL Lexer tests', () => { const mysqlParser = new PostgresSQL(); diff --git a/test/parser/pgsql/listener.test.ts b/test/parser/pgsql/listener.test.ts index 9962d5e..edd89c4 100644 --- a/test/parser/pgsql/listener.test.ts +++ b/test/parser/pgsql/listener.test.ts @@ -1,4 +1,6 @@ -import { PostgresSQL, PostgreSQLParserListener, ParseTreeListener } from '../../filters'; +import PostgresSQL from 'src/parser/pgsql'; +import { PostgreSQLParserListener } from 'src/lib/pgsql/PostgreSQLParserListener'; +import { ParseTreeListener } from 'antlr4ts/tree/ParseTreeListener'; describe('PostgresSQL Listener Tests', () => { const expectTableName = 'user1'; diff --git a/test/parser/pgsql/suggestion/multipleStatement.test.ts b/test/parser/pgsql/suggestion/multipleStatement.test.ts index e0edadf..c0a0585 100644 --- a/test/parser/pgsql/suggestion/multipleStatement.test.ts +++ b/test/parser/pgsql/suggestion/multipleStatement.test.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import path from 'path'; -import { CaretPosition, SyntaxContextType, PostgresSQL } from '../../../filters'; +import PostgresSQL from 'src/parser/pgsql'; +import { CaretPosition, SyntaxContextType } from 'src/parser/common/basic-parser-types'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'multipleStatement.sql'), diff --git a/test/parser/pgsql/suggestion/syntaxSuggestion.test.ts b/test/parser/pgsql/suggestion/syntaxSuggestion.test.ts index 110e538..fc96d7b 100644 --- a/test/parser/pgsql/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/pgsql/suggestion/syntaxSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { PostgresSQL, CaretPosition, SyntaxContextType } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import PostgresSQL from 'src/parser/pgsql'; +import { CaretPosition, SyntaxContextType } from 'src/parser/common/basic-parser-types'; +import { commentOtherLine } from 'test/helper'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'), diff --git a/test/parser/pgsql/suggestion/tokenSuggestion.test.ts b/test/parser/pgsql/suggestion/tokenSuggestion.test.ts index e0ca14e..c319de9 100644 --- a/test/parser/pgsql/suggestion/tokenSuggestion.test.ts +++ b/test/parser/pgsql/suggestion/tokenSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { PostgresSQL, CaretPosition } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import PostgresSQL from 'src/parser/pgsql'; +import { CaretPosition } from 'src/parser/common/basic-parser-types'; +import { commentOtherLine } from 'test/helper'; const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8'); diff --git a/test/parser/pgsql/syntax/alterStatement.test.ts b/test/parser/pgsql/syntax/alterStatement.test.ts index 2d72973..927f19c 100644 --- a/test/parser/pgsql/syntax/alterStatement.test.ts +++ b/test/parser/pgsql/syntax/alterStatement.test.ts @@ -1,5 +1,5 @@ -import { PostgresSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import PostgresSQL from 'src/parser/pgsql'; +import { readSQL } from 'test/helper'; const parser = new PostgresSQL(); diff --git a/test/parser/pgsql/syntax/createStatement.test.ts b/test/parser/pgsql/syntax/createStatement.test.ts index dfea18e..4308063 100644 --- a/test/parser/pgsql/syntax/createStatement.test.ts +++ b/test/parser/pgsql/syntax/createStatement.test.ts @@ -1,5 +1,5 @@ -import { PostgresSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import PostgresSQL from 'src/parser/pgsql'; +import { readSQL } from 'test/helper'; const parser = new PostgresSQL(); diff --git a/test/parser/pgsql/syntax/deleteStatement.test.ts b/test/parser/pgsql/syntax/deleteStatement.test.ts index d0abdf1..56f405c 100644 --- a/test/parser/pgsql/syntax/deleteStatement.test.ts +++ b/test/parser/pgsql/syntax/deleteStatement.test.ts @@ -1,5 +1,5 @@ -import { PostgresSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import PostgresSQL from 'src/parser/pgsql'; +import { readSQL } from 'test/helper'; const parser = new PostgresSQL(); diff --git a/test/parser/pgsql/syntax/dropStatement.test.ts b/test/parser/pgsql/syntax/dropStatement.test.ts index 4062def..3e51b6c 100644 --- a/test/parser/pgsql/syntax/dropStatement.test.ts +++ b/test/parser/pgsql/syntax/dropStatement.test.ts @@ -1,5 +1,5 @@ -import { PostgresSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import PostgresSQL from 'src/parser/pgsql'; +import { readSQL } from 'test/helper'; const parser = new PostgresSQL(); diff --git a/test/parser/pgsql/syntax/insertStatement.test.ts b/test/parser/pgsql/syntax/insertStatement.test.ts index 4f0ac53..6ab2091 100644 --- a/test/parser/pgsql/syntax/insertStatement.test.ts +++ b/test/parser/pgsql/syntax/insertStatement.test.ts @@ -1,5 +1,5 @@ -import { PostgresSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import PostgresSQL from 'src/parser/pgsql'; +import { readSQL } from 'test/helper'; const parser = new PostgresSQL(); diff --git a/test/parser/pgsql/syntax/others.test.ts b/test/parser/pgsql/syntax/others.test.ts index bd79780..e7c8d4a 100644 --- a/test/parser/pgsql/syntax/others.test.ts +++ b/test/parser/pgsql/syntax/others.test.ts @@ -1,5 +1,5 @@ -import { PostgresSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import PostgresSQL from 'src/parser/pgsql'; +import { readSQL } from 'test/helper'; const parser = new PostgresSQL(); diff --git a/test/parser/pgsql/syntax/selectStatement.test.ts b/test/parser/pgsql/syntax/selectStatement.test.ts index 3a41a48..aebe0cf 100644 --- a/test/parser/pgsql/syntax/selectStatement.test.ts +++ b/test/parser/pgsql/syntax/selectStatement.test.ts @@ -1,5 +1,5 @@ -import { PostgresSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import PostgresSQL from 'src/parser/pgsql'; +import { readSQL } from 'test/helper'; const parser = new PostgresSQL(); diff --git a/test/parser/pgsql/syntax/updateStatement.test.ts b/test/parser/pgsql/syntax/updateStatement.test.ts index 5db974b..4d6e002 100644 --- a/test/parser/pgsql/syntax/updateStatement.test.ts +++ b/test/parser/pgsql/syntax/updateStatement.test.ts @@ -1,5 +1,5 @@ -import { PostgresSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import PostgresSQL from 'src/parser/pgsql'; +import { readSQL } from 'test/helper'; const parser = new PostgresSQL(); diff --git a/test/parser/pgsql/validateInvalidSql.test.ts b/test/parser/pgsql/validateInvalidSql.test.ts index 832c3b9..aa4c56a 100644 --- a/test/parser/pgsql/validateInvalidSql.test.ts +++ b/test/parser/pgsql/validateInvalidSql.test.ts @@ -1,4 +1,4 @@ -import { PostgresSQL } from '../../filters'; +import PostgresSQL from 'src/parser/pgsql'; const randomText = `dhsdansdnkla ndjnsla ndnalks`; const unCompleteSQL = `CREATE TABLE`; diff --git a/test/parser/pgsql/visitor.test.ts b/test/parser/pgsql/visitor.test.ts index 2d3b07e..8364f26 100644 --- a/test/parser/pgsql/visitor.test.ts +++ b/test/parser/pgsql/visitor.test.ts @@ -1,4 +1,6 @@ -import { PostgresSQL, AbstractParseTreeVisitor, PostgreSQLParserVisitor } from '../../filters'; +import PostgresSQL from 'src/parser/pgsql'; +import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor'; +import { PostgreSQLParserVisitor } from 'src/lib/pgsql/PostgreSQLParserVisitor'; describe('MySQL Visitor Tests', () => { const expectTableName = 'user1'; diff --git a/test/parser/plsql/lexer.test.ts b/test/parser/plsql/lexer.test.ts index 0c4bce1..04fffef 100644 --- a/test/parser/plsql/lexer.test.ts +++ b/test/parser/plsql/lexer.test.ts @@ -1,4 +1,4 @@ -import { PLSQL } from '../../filters'; +import PLSQL from 'src/parser/plsql'; describe('PLSQL Lexer tests', () => { const parser = new PLSQL(); diff --git a/test/parser/plsql/listener.test.ts b/test/parser/plsql/listener.test.ts index 5406871..a330e80 100644 --- a/test/parser/plsql/listener.test.ts +++ b/test/parser/plsql/listener.test.ts @@ -1,4 +1,6 @@ -import { PLSQL, PlSqlParserListener, ParseTreeListener } from '../../filters'; +import PLSQL from 'src/parser/plsql'; +import { ParseTreeListener } from 'antlr4ts/tree/ParseTreeListener'; +import { PlSqlParserListener } from 'src/lib/plsql/PlSqlParserListener'; describe('PLSQL Listener Tests', () => { const expectTableName = 'user1'; diff --git a/test/parser/plsql/syntax.test.ts b/test/parser/plsql/syntax.test.ts index c9ac68f..6ef0dc6 100644 --- a/test/parser/plsql/syntax.test.ts +++ b/test/parser/plsql/syntax.test.ts @@ -1,4 +1,4 @@ -import { PLSQL } from '../../filters'; +import PLSQL from 'src/parser/plsql'; describe('PLSQL Syntax Tests', () => { const parser = new PLSQL(); diff --git a/test/parser/plsql/visitor.test.ts b/test/parser/plsql/visitor.test.ts index d43928d..430f0b9 100644 --- a/test/parser/plsql/visitor.test.ts +++ b/test/parser/plsql/visitor.test.ts @@ -1,4 +1,6 @@ -import { PLSQL, AbstractParseTreeVisitor, PlSqlParserVisitor } from '../../filters'; +import PLSQL from 'src/parser/plsql'; +import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor'; +import { PlSqlParserVisitor } from 'src/lib/plsql/PlSqlParserVisitor'; describe('PLSQL Visitor Tests', () => { const expectTableName = 'user1'; diff --git a/test/parser/spark/errorStrategy.test.ts b/test/parser/spark/errorStrategy.test.ts index e517de2..b301b39 100644 --- a/test/parser/spark/errorStrategy.test.ts +++ b/test/parser/spark/errorStrategy.test.ts @@ -1,4 +1,5 @@ -import { SparkSQL, SparkSqlSplitListener, SparkSqlParserListener } from '../../filters'; +import SparkSQL, { SparkSqlSplitListener } from 'src/parser/spark'; +import { SparkSqlParserListener } from 'src/lib/spark/SparkSqlParserListener'; const validSQL1 = `INSERT INTO country_page_view VALUES ('Chinese', 'mumiao', 18), diff --git a/test/parser/spark/lexer.test.ts b/test/parser/spark/lexer.test.ts index ac0b6ff..6062f78 100644 --- a/test/parser/spark/lexer.test.ts +++ b/test/parser/spark/lexer.test.ts @@ -1,4 +1,4 @@ -import { SparkSQL } from '../../filters'; +import SparkSQL from 'src/parser/spark'; describe('SparkSQL Lexer tests', () => { const parser = new SparkSQL(); diff --git a/test/parser/spark/listener.test.ts b/test/parser/spark/listener.test.ts index 9053df1..0fe1e74 100644 --- a/test/parser/spark/listener.test.ts +++ b/test/parser/spark/listener.test.ts @@ -1,4 +1,6 @@ -import { SparkSQL, ParseTreeListener, SparkSqlParserListener } from '../../filters'; +import SparkSQL from 'src/parser/spark'; +import { SparkSqlParserListener } from 'src/lib/spark/SparkSqlParserListener'; +import { ParseTreeListener } from 'antlr4ts/tree/ParseTreeListener'; describe('Spark SQL Listener Tests', () => { const expectTableName = 'user1'; diff --git a/test/parser/spark/suggestion/multipleStatement.test.ts b/test/parser/spark/suggestion/multipleStatement.test.ts index 0da2d09..aad327d 100644 --- a/test/parser/spark/suggestion/multipleStatement.test.ts +++ b/test/parser/spark/suggestion/multipleStatement.test.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import path from 'path'; -import { SparkSQL, CaretPosition, SyntaxContextType } from '../../../filters'; +import SparkSQL from 'src/parser/spark'; +import { CaretPosition, SyntaxContextType } from 'src/parser/common/basic-parser-types'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'multipleStatement.sql'), diff --git a/test/parser/spark/suggestion/syntaxSuggestion.test.ts b/test/parser/spark/suggestion/syntaxSuggestion.test.ts index 9953238..c561625 100644 --- a/test/parser/spark/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/spark/suggestion/syntaxSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { SparkSQL, CaretPosition, SyntaxContextType } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { CaretPosition, SyntaxContextType } from 'src/parser/common/basic-parser-types'; +import { commentOtherLine } from 'test/helper'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'), diff --git a/test/parser/spark/suggestion/tokenSuggestion.test.ts b/test/parser/spark/suggestion/tokenSuggestion.test.ts index 7ece95f..bbdb4a2 100644 --- a/test/parser/spark/suggestion/tokenSuggestion.test.ts +++ b/test/parser/spark/suggestion/tokenSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { SparkSQL, CaretPosition } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { CaretPosition } from 'src/parser/common/basic-parser-types'; +import { commentOtherLine } from 'test/helper'; const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8'); diff --git a/test/parser/spark/syntax/addStatement.test.ts b/test/parser/spark/syntax/addStatement.test.ts index d405312..73ae81a 100644 --- a/test/parser/spark/syntax/addStatement.test.ts +++ b/test/parser/spark/syntax/addStatement.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/alert.test.ts b/test/parser/spark/syntax/alert.test.ts index 4a41236..8114ffb 100644 --- a/test/parser/spark/syntax/alert.test.ts +++ b/test/parser/spark/syntax/alert.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/analyzeTableStatement.test.ts b/test/parser/spark/syntax/analyzeTableStatement.test.ts index c2f98e4..017d7ff 100644 --- a/test/parser/spark/syntax/analyzeTableStatement.test.ts +++ b/test/parser/spark/syntax/analyzeTableStatement.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/cacheStatement.test.ts b/test/parser/spark/syntax/cacheStatement.test.ts index 088ef1c..4c479cb 100644 --- a/test/parser/spark/syntax/cacheStatement.test.ts +++ b/test/parser/spark/syntax/cacheStatement.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/create.test.ts b/test/parser/spark/syntax/create.test.ts index b5d72d1..124bac6 100644 --- a/test/parser/spark/syntax/create.test.ts +++ b/test/parser/spark/syntax/create.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/describeStatement.test.ts b/test/parser/spark/syntax/describeStatement.test.ts index f515554..1718cf1 100644 --- a/test/parser/spark/syntax/describeStatement.test.ts +++ b/test/parser/spark/syntax/describeStatement.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/drop.test.ts b/test/parser/spark/syntax/drop.test.ts index 271c7cd..15b3c61 100644 --- a/test/parser/spark/syntax/drop.test.ts +++ b/test/parser/spark/syntax/drop.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/insertStatement.test.ts b/test/parser/spark/syntax/insertStatement.test.ts index f7075c2..08c4055 100644 --- a/test/parser/spark/syntax/insertStatement.test.ts +++ b/test/parser/spark/syntax/insertStatement.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/kwMultipleValues.test.ts b/test/parser/spark/syntax/kwMultipleValues.test.ts index e5c6638..27b0a1b 100644 --- a/test/parser/spark/syntax/kwMultipleValues.test.ts +++ b/test/parser/spark/syntax/kwMultipleValues.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/listStatement.test.ts b/test/parser/spark/syntax/listStatement.test.ts index 901392e..b6648dc 100644 --- a/test/parser/spark/syntax/listStatement.test.ts +++ b/test/parser/spark/syntax/listStatement.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/loadStatement.test.ts b/test/parser/spark/syntax/loadStatement.test.ts index 7f9d67b..c3231de 100644 --- a/test/parser/spark/syntax/loadStatement.test.ts +++ b/test/parser/spark/syntax/loadStatement.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/refreshStatement.test.ts b/test/parser/spark/syntax/refreshStatement.test.ts index 936cecf..9d7beb4 100644 --- a/test/parser/spark/syntax/refreshStatement.test.ts +++ b/test/parser/spark/syntax/refreshStatement.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/resetStatement.test.ts b/test/parser/spark/syntax/resetStatement.test.ts index 9f0311d..ca9df3c 100644 --- a/test/parser/spark/syntax/resetStatement.test.ts +++ b/test/parser/spark/syntax/resetStatement.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/selectStatement.test.ts b/test/parser/spark/syntax/selectStatement.test.ts index 5dd6e6a..07ef7e9 100644 --- a/test/parser/spark/syntax/selectStatement.test.ts +++ b/test/parser/spark/syntax/selectStatement.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/setStatement.test.ts b/test/parser/spark/syntax/setStatement.test.ts index 0babd8d..7d98342 100644 --- a/test/parser/spark/syntax/setStatement.test.ts +++ b/test/parser/spark/syntax/setStatement.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/showStatement.test.ts b/test/parser/spark/syntax/showStatement.test.ts index d8d2b93..7d9a12b 100644 --- a/test/parser/spark/syntax/showStatement.test.ts +++ b/test/parser/spark/syntax/showStatement.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/table.test.ts b/test/parser/spark/syntax/table.test.ts index 945f5be..5ae8ff1 100644 --- a/test/parser/spark/syntax/table.test.ts +++ b/test/parser/spark/syntax/table.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/syntax/useDatabase.test.ts b/test/parser/spark/syntax/useDatabase.test.ts index 7841ffa..b72b715 100644 --- a/test/parser/spark/syntax/useDatabase.test.ts +++ b/test/parser/spark/syntax/useDatabase.test.ts @@ -1,5 +1,5 @@ -import { SparkSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import SparkSQL from 'src/parser/spark'; +import { readSQL } from 'test/helper'; const parser = new SparkSQL(); diff --git a/test/parser/spark/validateInvalidSql.test.ts b/test/parser/spark/validateInvalidSql.test.ts index 82d9d16..2e6b01b 100644 --- a/test/parser/spark/validateInvalidSql.test.ts +++ b/test/parser/spark/validateInvalidSql.test.ts @@ -1,4 +1,4 @@ -import { SparkSQL } from '../../filters'; +import SparkSQL from 'src/parser/spark'; const randomText = `dhsdansdnkla ndjnsla ndnalks`; const unCompleteSQL = `CREATE TABLE`; diff --git a/test/parser/spark/visitor.test.ts b/test/parser/spark/visitor.test.ts index f942fe3..224ef0d 100644 --- a/test/parser/spark/visitor.test.ts +++ b/test/parser/spark/visitor.test.ts @@ -1,4 +1,6 @@ -import { SparkSQL, SparkSqlParserVisitor, AbstractParseTreeVisitor } from '../../filters'; +import SparkSQL from 'src/parser/spark'; +import { SparkSqlParserVisitor } from 'src/lib/spark/SparkSqlParserVisitor'; +import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor'; describe('Spark SQL Visitor Tests', () => { const expectTableName = 'user1'; diff --git a/test/parser/trinosql/errorStrategy.test.ts b/test/parser/trinosql/errorStrategy.test.ts index 63dc11c..04a951c 100644 --- a/test/parser/trinosql/errorStrategy.test.ts +++ b/test/parser/trinosql/errorStrategy.test.ts @@ -1,4 +1,5 @@ -import { TrinoSQL, TrinoSqlSplitListener, TrinoSqlListener } from '../../filters'; +import TrinoSQL, { TrinoSqlSplitListener } from 'src/parser/trinosql'; +import { TrinoSqlListener } from 'src/lib/trinosql/TrinoSqlListener'; const validSQL1 = `INSERT INTO country_page_view VALUES ('Chinese', 'mumiao', 18), diff --git a/test/parser/trinosql/lexer.test.ts b/test/parser/trinosql/lexer.test.ts index 505ac2b..b0e4b24 100644 --- a/test/parser/trinosql/lexer.test.ts +++ b/test/parser/trinosql/lexer.test.ts @@ -1,4 +1,4 @@ -import { TrinoSQL } from '../../filters'; +import TrinoSQL from 'src/parser/trinosql'; describe('trinoSQL Lexer tests', () => { const parser = new TrinoSQL(); diff --git a/test/parser/trinosql/listener.test.ts b/test/parser/trinosql/listener.test.ts index 157e948..7bcefef 100644 --- a/test/parser/trinosql/listener.test.ts +++ b/test/parser/trinosql/listener.test.ts @@ -1,4 +1,6 @@ -import { TrinoSQL, TrinoSqlListener, ParseTreeListener } from '../../filters'; +import TrinoSQL from 'src/parser/trinosql'; +import { TrinoSqlListener } from 'src/lib/trinosql/TrinoSqlListener'; +import { ParseTreeListener } from 'antlr4ts/tree/ParseTreeListener'; describe('trino SQL Listener Tests', () => { const expectTableName = 'user1'; diff --git a/test/parser/trinosql/suggestion/multipleStatement.test.ts b/test/parser/trinosql/suggestion/multipleStatement.test.ts index ffff017..a6ebd7a 100644 --- a/test/parser/trinosql/suggestion/multipleStatement.test.ts +++ b/test/parser/trinosql/suggestion/multipleStatement.test.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import path from 'path'; -import { TrinoSQL, CaretPosition, SyntaxContextType } from '../../../filters'; +import TrinoSQL from 'src/parser/trinosql'; +import { CaretPosition, SyntaxContextType } from 'src/parser/common/basic-parser-types'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'multipleStatement.sql'), diff --git a/test/parser/trinosql/suggestion/syntaxSuggestion.test.ts b/test/parser/trinosql/suggestion/syntaxSuggestion.test.ts index b52262c..0d5dc88 100644 --- a/test/parser/trinosql/suggestion/syntaxSuggestion.test.ts +++ b/test/parser/trinosql/suggestion/syntaxSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { TrinoSQL, CaretPosition, SyntaxContextType } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { CaretPosition, SyntaxContextType } from 'src/parser/common/basic-parser-types'; +import { commentOtherLine } from 'test/helper'; const syntaxSql = fs.readFileSync( path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'), diff --git a/test/parser/trinosql/suggestion/tokenSuggestion.test.ts b/test/parser/trinosql/suggestion/tokenSuggestion.test.ts index 2e24c1a..abff7bf 100644 --- a/test/parser/trinosql/suggestion/tokenSuggestion.test.ts +++ b/test/parser/trinosql/suggestion/tokenSuggestion.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { TrinoSQL, CaretPosition } from '../../../filters'; -import { commentOtherLine } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { CaretPosition } from 'src/parser/common/basic-parser-types'; +import { commentOtherLine } from 'test/helper'; const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8'); diff --git a/test/parser/trinosql/syntax/alterStatement.test.ts b/test/parser/trinosql/syntax/alterStatement.test.ts index 606247d..2854186 100644 --- a/test/parser/trinosql/syntax/alterStatement.test.ts +++ b/test/parser/trinosql/syntax/alterStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { table: readSQL(__dirname, 'alter_table.sql'), diff --git a/test/parser/trinosql/syntax/analyzeStatement.test.ts b/test/parser/trinosql/syntax/analyzeStatement.test.ts index 36ef875..905d1e7 100644 --- a/test/parser/trinosql/syntax/analyzeStatement.test.ts +++ b/test/parser/trinosql/syntax/analyzeStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { analyze: readSQL(__dirname, 'analyze.sql'), diff --git a/test/parser/trinosql/syntax/callStatement.test.ts b/test/parser/trinosql/syntax/callStatement.test.ts index 53d7f36..adeacf3 100644 --- a/test/parser/trinosql/syntax/callStatement.test.ts +++ b/test/parser/trinosql/syntax/callStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { call: readSQL(__dirname, 'call.sql'), diff --git a/test/parser/trinosql/syntax/commentStatement.test.ts b/test/parser/trinosql/syntax/commentStatement.test.ts index b0e7edc..68d9349 100644 --- a/test/parser/trinosql/syntax/commentStatement.test.ts +++ b/test/parser/trinosql/syntax/commentStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { comment: readSQL(__dirname, 'comment.sql'), diff --git a/test/parser/trinosql/syntax/commitStatement.test.ts b/test/parser/trinosql/syntax/commitStatement.test.ts index 9cca44a..b9cfa54 100644 --- a/test/parser/trinosql/syntax/commitStatement.test.ts +++ b/test/parser/trinosql/syntax/commitStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { commit: readSQL(__dirname, 'commit.sql'), diff --git a/test/parser/trinosql/syntax/createStatement.test.ts b/test/parser/trinosql/syntax/createStatement.test.ts index ba5a330..d177d62 100644 --- a/test/parser/trinosql/syntax/createStatement.test.ts +++ b/test/parser/trinosql/syntax/createStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { table: readSQL(__dirname, 'create_table.sql'), diff --git a/test/parser/trinosql/syntax/deallocatePrepareStatement.test.ts b/test/parser/trinosql/syntax/deallocatePrepareStatement.test.ts index 529d6f7..79bcb37 100644 --- a/test/parser/trinosql/syntax/deallocatePrepareStatement.test.ts +++ b/test/parser/trinosql/syntax/deallocatePrepareStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { deallocatePrepare: readSQL(__dirname, 'deallocate_prepare.sql'), diff --git a/test/parser/trinosql/syntax/deleteStatement.test.ts b/test/parser/trinosql/syntax/deleteStatement.test.ts index 1495194..e76b32d 100644 --- a/test/parser/trinosql/syntax/deleteStatement.test.ts +++ b/test/parser/trinosql/syntax/deleteStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { delete: readSQL(__dirname, 'delete.sql'), diff --git a/test/parser/trinosql/syntax/denyStatement.test.ts b/test/parser/trinosql/syntax/denyStatement.test.ts index 0a6d4d8..babf165 100644 --- a/test/parser/trinosql/syntax/denyStatement.test.ts +++ b/test/parser/trinosql/syntax/denyStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { deny: readSQL(__dirname, 'deny.sql'), diff --git a/test/parser/trinosql/syntax/describeStatement.test.ts b/test/parser/trinosql/syntax/describeStatement.test.ts index 5f555ba..e94c23a 100644 --- a/test/parser/trinosql/syntax/describeStatement.test.ts +++ b/test/parser/trinosql/syntax/describeStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { describe: readSQL(__dirname, 'describe.sql'), diff --git a/test/parser/trinosql/syntax/dropStatement.test.ts b/test/parser/trinosql/syntax/dropStatement.test.ts index 4d66a7c..90dabdc 100644 --- a/test/parser/trinosql/syntax/dropStatement.test.ts +++ b/test/parser/trinosql/syntax/dropStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { table: readSQL(__dirname, 'drop_table.sql'), diff --git a/test/parser/trinosql/syntax/executeStatement.test.ts b/test/parser/trinosql/syntax/executeStatement.test.ts index 70c0356..b887a3e 100644 --- a/test/parser/trinosql/syntax/executeStatement.test.ts +++ b/test/parser/trinosql/syntax/executeStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { execute: readSQL(__dirname, 'execute.sql'), diff --git a/test/parser/trinosql/syntax/explainStatement.test.ts b/test/parser/trinosql/syntax/explainStatement.test.ts index 0507c6c..0dbbdb9 100644 --- a/test/parser/trinosql/syntax/explainStatement.test.ts +++ b/test/parser/trinosql/syntax/explainStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { explain: readSQL(__dirname, 'explain.sql'), diff --git a/test/parser/trinosql/syntax/grantStatement.test.ts b/test/parser/trinosql/syntax/grantStatement.test.ts index 3d52e33..332cefc 100644 --- a/test/parser/trinosql/syntax/grantStatement.test.ts +++ b/test/parser/trinosql/syntax/grantStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { grant: readSQL(__dirname, 'grant.sql'), diff --git a/test/parser/trinosql/syntax/insertStatement.test.ts b/test/parser/trinosql/syntax/insertStatement.test.ts index 08d7c33..446c046 100644 --- a/test/parser/trinosql/syntax/insertStatement.test.ts +++ b/test/parser/trinosql/syntax/insertStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { insertIntoTable: readSQL(__dirname, 'insert_into.sql'), diff --git a/test/parser/trinosql/syntax/matchRecognizeStatement.test.ts b/test/parser/trinosql/syntax/matchRecognizeStatement.test.ts index edc83ad..804fb22 100644 --- a/test/parser/trinosql/syntax/matchRecognizeStatement.test.ts +++ b/test/parser/trinosql/syntax/matchRecognizeStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { matchRecognize: readSQL(__dirname, 'match_recognize.sql'), diff --git a/test/parser/trinosql/syntax/merge.test.ts b/test/parser/trinosql/syntax/merge.test.ts index 4d42810..9c5c0ea 100644 --- a/test/parser/trinosql/syntax/merge.test.ts +++ b/test/parser/trinosql/syntax/merge.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { merge: readSQL(__dirname, 'merge.sql'), diff --git a/test/parser/trinosql/syntax/prepareStatement.test.ts b/test/parser/trinosql/syntax/prepareStatement.test.ts index 7dc44fb..be8f699 100644 --- a/test/parser/trinosql/syntax/prepareStatement.test.ts +++ b/test/parser/trinosql/syntax/prepareStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { prepare: readSQL(__dirname, 'prepare.sql'), diff --git a/test/parser/trinosql/syntax/refreshMaterializedViewStatement.test.ts b/test/parser/trinosql/syntax/refreshMaterializedViewStatement.test.ts index 27f0bcb..97a9467 100644 --- a/test/parser/trinosql/syntax/refreshMaterializedViewStatement.test.ts +++ b/test/parser/trinosql/syntax/refreshMaterializedViewStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { refreshMaterializedView: readSQL(__dirname, 'refresh_materialized_view.sql'), diff --git a/test/parser/trinosql/syntax/resetSessionStatement.test.ts b/test/parser/trinosql/syntax/resetSessionStatement.test.ts index 622fa98..f9f3ead 100644 --- a/test/parser/trinosql/syntax/resetSessionStatement.test.ts +++ b/test/parser/trinosql/syntax/resetSessionStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { resetSession: readSQL(__dirname, 'reset_session.sql'), diff --git a/test/parser/trinosql/syntax/revokeStatement.test.ts b/test/parser/trinosql/syntax/revokeStatement.test.ts index dbe61a0..c37f9a6 100644 --- a/test/parser/trinosql/syntax/revokeStatement.test.ts +++ b/test/parser/trinosql/syntax/revokeStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { revoke: readSQL(__dirname, 'revoke.sql'), diff --git a/test/parser/trinosql/syntax/rollbackTransactionStatement.test.ts b/test/parser/trinosql/syntax/rollbackTransactionStatement.test.ts index 6f0709d..a75a811 100644 --- a/test/parser/trinosql/syntax/rollbackTransactionStatement.test.ts +++ b/test/parser/trinosql/syntax/rollbackTransactionStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { rollbackTransaction: readSQL(__dirname, 'rollback_transaction.sql'), diff --git a/test/parser/trinosql/syntax/selectStatement.test.ts b/test/parser/trinosql/syntax/selectStatement.test.ts index 0acfd32..3f3feea 100644 --- a/test/parser/trinosql/syntax/selectStatement.test.ts +++ b/test/parser/trinosql/syntax/selectStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { select: readSQL(__dirname, 'select.sql'), diff --git a/test/parser/trinosql/syntax/setStatement.test.ts b/test/parser/trinosql/syntax/setStatement.test.ts index c70a626..8fde4f1 100644 --- a/test/parser/trinosql/syntax/setStatement.test.ts +++ b/test/parser/trinosql/syntax/setStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { role: readSQL(__dirname, 'set_role.sql'), diff --git a/test/parser/trinosql/syntax/showStatement.test.ts b/test/parser/trinosql/syntax/showStatement.test.ts index b7f2b06..f9b136a 100644 --- a/test/parser/trinosql/syntax/showStatement.test.ts +++ b/test/parser/trinosql/syntax/showStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { tables: readSQL(__dirname, 'show_tables.sql'), diff --git a/test/parser/trinosql/syntax/startTransactionStatement.test.ts b/test/parser/trinosql/syntax/startTransactionStatement.test.ts index 3cae3a7..a172c80 100644 --- a/test/parser/trinosql/syntax/startTransactionStatement.test.ts +++ b/test/parser/trinosql/syntax/startTransactionStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { startTransaction: readSQL(__dirname, 'start_transaction.sql'), diff --git a/test/parser/trinosql/syntax/truncateTableStatement.test.ts b/test/parser/trinosql/syntax/truncateTableStatement.test.ts index 4211943..0600ab2 100644 --- a/test/parser/trinosql/syntax/truncateTableStatement.test.ts +++ b/test/parser/trinosql/syntax/truncateTableStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { truncateTable: readSQL(__dirname, 'truncate_table.sql'), diff --git a/test/parser/trinosql/syntax/updateStatement.test.ts b/test/parser/trinosql/syntax/updateStatement.test.ts index caa5ab0..0362270 100644 --- a/test/parser/trinosql/syntax/updateStatement.test.ts +++ b/test/parser/trinosql/syntax/updateStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { update: readSQL(__dirname, 'update.sql'), diff --git a/test/parser/trinosql/syntax/useStatement.test.ts b/test/parser/trinosql/syntax/useStatement.test.ts index 6b61522..5e07eb6 100644 --- a/test/parser/trinosql/syntax/useStatement.test.ts +++ b/test/parser/trinosql/syntax/useStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { use: readSQL(__dirname, 'use.sql'), diff --git a/test/parser/trinosql/syntax/valuesStatement.test.ts b/test/parser/trinosql/syntax/valuesStatement.test.ts index 347babf..2952b68 100644 --- a/test/parser/trinosql/syntax/valuesStatement.test.ts +++ b/test/parser/trinosql/syntax/valuesStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { values: readSQL(__dirname, 'values.sql'), diff --git a/test/parser/trinosql/syntax/windowWithRowPatternRecognitionStatement.test.ts b/test/parser/trinosql/syntax/windowWithRowPatternRecognitionStatement.test.ts index ddadbed..f99b2a8 100644 --- a/test/parser/trinosql/syntax/windowWithRowPatternRecognitionStatement.test.ts +++ b/test/parser/trinosql/syntax/windowWithRowPatternRecognitionStatement.test.ts @@ -1,5 +1,5 @@ -import { TrinoSQL } from '../../../filters'; -import { readSQL } from '../../../helper'; +import TrinoSQL from 'src/parser/trinosql'; +import { readSQL } from 'test/helper'; const features = { windowWithRowPatternRecognition: readSQL(__dirname, 'window_with_row_pattern_recognition.sql'), diff --git a/test/parser/trinosql/validateInvalidSql.test.ts b/test/parser/trinosql/validateInvalidSql.test.ts index cf13b25..492469d 100644 --- a/test/parser/trinosql/validateInvalidSql.test.ts +++ b/test/parser/trinosql/validateInvalidSql.test.ts @@ -1,4 +1,4 @@ -import { TrinoSQL } from '../../filters'; +import TrinoSQL from 'src/parser/trinosql'; const randomText = `dhsdansdnkla ndjnsla ndnalks`; const unCompleteSQL = `CREATE TABLE`; diff --git a/test/parser/trinosql/visitor.test.ts b/test/parser/trinosql/visitor.test.ts index 07c84ad..a308628 100644 --- a/test/parser/trinosql/visitor.test.ts +++ b/test/parser/trinosql/visitor.test.ts @@ -1,4 +1,6 @@ -import { TrinoSQL, TrinoSqlVisitor, AbstractParseTreeVisitor } from '../../filters'; +import TrinoSQL from 'src/parser/trinosql'; +import { TrinoSqlVisitor } from 'src/lib/trinosql/TrinoSqlVisitor'; +import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor'; describe('trino SQL Visitor Tests', () => { const expectTableName = 'user1'; diff --git a/test/tsconfig.json b/test/tsconfig.json new file mode 100644 index 0000000..68b066a --- /dev/null +++ b/test/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "baseUrl": "../", + "noEmit": true, + "paths": { + "src/*": ["src/*"], + "test/*": ["test/*"] + } + }, + "include": [ + "./**/*" + ] +} \ No newline at end of file diff --git a/tsconfig.check.json b/tsconfig.check.json deleted file mode 100644 index f868fea..0000000 --- a/tsconfig.check.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "noEmit": true - }, - "include": ["./src/**/*", "./test/**/*"] -} \ No newline at end of file