2019-03-11 04:30:58 +08:00
|
|
|
|
// @ts-check
|
2021-04-18 04:26:40 +08:00
|
|
|
|
'use strict';
|
2015-06-02 02:39:11 +08:00
|
|
|
|
|
2021-04-18 04:26:40 +08:00
|
|
|
|
const TestDiscovery = require('./helper/test-discovery');
|
|
|
|
|
const TestCase = require('./helper/test-case');
|
|
|
|
|
const path = require('path');
|
|
|
|
|
const { argv } = require('yargs');
|
2015-06-02 02:39:11 +08:00
|
|
|
|
|
2019-03-11 04:30:58 +08:00
|
|
|
|
const testSuite =
|
|
|
|
|
(argv.language)
|
2021-10-20 01:34:41 +08:00
|
|
|
|
? TestDiscovery.loadSomeTests(argv.language)
|
2019-03-11 04:30:58 +08:00
|
|
|
|
// load complete test suite
|
2021-10-20 01:34:41 +08:00
|
|
|
|
: TestDiscovery.loadAllTests();
|
2015-06-02 02:39:11 +08:00
|
|
|
|
|
2021-04-03 17:06:21 +08:00
|
|
|
|
const update = !!argv.update;
|
2020-08-17 22:22:21 +08:00
|
|
|
|
|
2015-06-02 02:39:11 +08:00
|
|
|
|
// define tests for all tests in all languages in the test suite
|
2021-10-20 01:34:41 +08:00
|
|
|
|
for (const [languageIdentifier, files] of testSuite) {
|
|
|
|
|
describe("Testing language '" + languageIdentifier + "'", function () {
|
|
|
|
|
this.timeout(10000);
|
2015-06-02 02:39:11 +08:00
|
|
|
|
|
2021-10-20 01:34:41 +08:00
|
|
|
|
for (const filePath of files) {
|
|
|
|
|
const fileName = path.basename(filePath, path.extname(filePath));
|
2015-10-10 18:48:26 +08:00
|
|
|
|
|
2021-10-20 01:34:41 +08:00
|
|
|
|
it("– should pass test case '" + fileName + "'", function () {
|
|
|
|
|
TestCase.runTestCase(languageIdentifier, filePath, update ? 'update' : 'insert');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
2019-03-11 04:30:58 +08:00
|
|
|
|
}
|