@abaplint/transpiler 1.7.13 → 1.7.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/statements/do.js +4 -4
- package/build/src/unit_test.js +37 -37
- package/package.json +41 -41
|
@@ -12,14 +12,14 @@ class DoTranspiler {
|
|
|
12
12
|
const source = new expressions_1.SourceTranspiler(true).transpile(found, traversal).getCode();
|
|
13
13
|
const idSource = unique_identifier_1.UniqueIdentifier.get();
|
|
14
14
|
const id = unique_identifier_1.UniqueIdentifier.get();
|
|
15
|
-
return new chunk_1.Chunk(`const ${idSource} = ${source};
|
|
16
|
-
for (let ${id} = 0; ${id} < ${idSource}; ${id}++) {
|
|
15
|
+
return new chunk_1.Chunk(`const ${idSource} = ${source};
|
|
16
|
+
for (let ${id} = 0; ${id} < ${idSource}; ${id}++) {
|
|
17
17
|
abap.builtin.sy.get().index.set(${id} + 1);`);
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
20
|
const unique = unique_identifier_1.UniqueIdentifier.get();
|
|
21
|
-
return new chunk_1.Chunk(`let ${unique} = 1;
|
|
22
|
-
while (true) {
|
|
21
|
+
return new chunk_1.Chunk(`let ${unique} = 1;
|
|
22
|
+
while (true) {
|
|
23
23
|
abap.builtin.sy.get().index.set(${unique}++);`);
|
|
24
24
|
}
|
|
25
25
|
}
|
package/build/src/unit_test.js
CHANGED
|
@@ -5,9 +5,9 @@ const abaplint = require("@abaplint/core");
|
|
|
5
5
|
class UnitTest {
|
|
6
6
|
// todo, move this somewhere else, its much more than just unit test relevant
|
|
7
7
|
initializationScript(reg, dbSetup) {
|
|
8
|
-
let ret = `import runtime from "@abaplint/runtime";
|
|
9
|
-
global.abap = new runtime.ABAP();
|
|
10
|
-
${this.buildImports(reg)}
|
|
8
|
+
let ret = `import runtime from "@abaplint/runtime";
|
|
9
|
+
global.abap = new runtime.ABAP();
|
|
10
|
+
${this.buildImports(reg)}
|
|
11
11
|
export async function initializeABAP(settings) {\n`;
|
|
12
12
|
if (dbSetup === "") {
|
|
13
13
|
ret += `// no database artifacts, skip DB initialization\n`;
|
|
@@ -19,20 +19,20 @@ export async function initializeABAP(settings) {\n`;
|
|
|
19
19
|
return ret;
|
|
20
20
|
}
|
|
21
21
|
unitTestScript(reg, skip, _only) {
|
|
22
|
-
let ret = `import fs from "fs";
|
|
23
|
-
import path from "path";
|
|
24
|
-
import {dirname} from 'path';
|
|
25
|
-
import {fileURLToPath} from 'url';
|
|
26
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
27
|
-
import {initializeABAP} from "./init.mjs";
|
|
28
|
-
import runtime from "@abaplint/runtime";
|
|
29
|
-
|
|
30
|
-
async function run() {
|
|
31
|
-
await initializeABAP();
|
|
32
|
-
const unit = new runtime.UnitTestResult();
|
|
33
|
-
let clas;
|
|
34
|
-
let locl;
|
|
35
|
-
let meth;
|
|
22
|
+
let ret = `import fs from "fs";
|
|
23
|
+
import path from "path";
|
|
24
|
+
import {dirname} from 'path';
|
|
25
|
+
import {fileURLToPath} from 'url';
|
|
26
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
27
|
+
import {initializeABAP} from "./init.mjs";
|
|
28
|
+
import runtime from "@abaplint/runtime";
|
|
29
|
+
|
|
30
|
+
async function run() {
|
|
31
|
+
await initializeABAP();
|
|
32
|
+
const unit = new runtime.UnitTestResult();
|
|
33
|
+
let clas;
|
|
34
|
+
let locl;
|
|
35
|
+
let meth;
|
|
36
36
|
try {\n`;
|
|
37
37
|
for (const obj of reg.getObjects()) {
|
|
38
38
|
if (reg.isDependency(obj) || !(obj instanceof abaplint.Objects.Class)) {
|
|
@@ -47,8 +47,8 @@ try {\n`;
|
|
|
47
47
|
|| def.methods.length === 0) {
|
|
48
48
|
continue;
|
|
49
49
|
}
|
|
50
|
-
ret += `{
|
|
51
|
-
const {${def.name}} = await import("./${obj.getName().toLowerCase()}.${obj.getType().toLowerCase()}.testclasses.mjs");
|
|
50
|
+
ret += `{
|
|
51
|
+
const {${def.name}} = await import("./${obj.getName().toLowerCase()}.${obj.getType().toLowerCase()}.testclasses.mjs");
|
|
52
52
|
locl = clas.addTestClass("${def.name}");\n`;
|
|
53
53
|
ret += `if (${def.name}.class_setup) await ${def.name}.class_setup();\n`;
|
|
54
54
|
for (const m of def.methods) {
|
|
@@ -76,24 +76,24 @@ locl = clas.addTestClass("${def.name}");\n`;
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
ret += `// -------------------END-------------------
|
|
80
|
-
console.log(abap.console.get());
|
|
81
|
-
fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
|
|
82
|
-
} catch (e) {
|
|
83
|
-
if (meth) {
|
|
84
|
-
meth.fail();
|
|
85
|
-
}
|
|
86
|
-
console.log(abap.console.get());
|
|
87
|
-
fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
|
|
88
|
-
throw e;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
run().then(() => {
|
|
93
|
-
process.exit(0);
|
|
94
|
-
}).catch((err) => {
|
|
95
|
-
console.log(err);
|
|
96
|
-
process.exit(1);
|
|
79
|
+
ret += `// -------------------END-------------------
|
|
80
|
+
console.log(abap.console.get());
|
|
81
|
+
fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
|
|
82
|
+
} catch (e) {
|
|
83
|
+
if (meth) {
|
|
84
|
+
meth.fail();
|
|
85
|
+
}
|
|
86
|
+
console.log(abap.console.get());
|
|
87
|
+
fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
|
|
88
|
+
throw e;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
run().then(() => {
|
|
93
|
+
process.exit(0);
|
|
94
|
+
}).catch((err) => {
|
|
95
|
+
console.log(err);
|
|
96
|
+
process.exit(1);
|
|
97
97
|
});`;
|
|
98
98
|
return ret;
|
|
99
99
|
}
|
package/package.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "1.7.
|
|
4
|
-
"description": "Transpiler",
|
|
5
|
-
"main": "build/src/index.js",
|
|
6
|
-
"typings": "build/src/index.d.ts",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/abaplint/transpiler.git"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"compile": "tsc",
|
|
13
|
-
"publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
14
|
-
"publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
15
|
-
"test": "npm run compile && mocha"
|
|
16
|
-
},
|
|
17
|
-
"mocha": {
|
|
18
|
-
"recursive": true,
|
|
19
|
-
"reporter": "progress",
|
|
20
|
-
"spec": "build/test/**/*.js",
|
|
21
|
-
"require": "source-map-support/register"
|
|
22
|
-
},
|
|
23
|
-
"keywords": [
|
|
24
|
-
"ABAP",
|
|
25
|
-
"abaplint"
|
|
26
|
-
],
|
|
27
|
-
"author": "abaplint",
|
|
28
|
-
"license": "MIT",
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@abaplint/core": "^2.83.23",
|
|
31
|
-
"source-map": "^0.7.3"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@types/chai": "^4.3.0",
|
|
35
|
-
"@types/mocha": "^9.0.0",
|
|
36
|
-
"chai": "^4.3.4",
|
|
37
|
-
"mocha": "^9.1.3",
|
|
38
|
-
"source-map-support": "^0.5.21",
|
|
39
|
-
"typescript": "^4.5.4"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@abaplint/transpiler",
|
|
3
|
+
"version": "1.7.14",
|
|
4
|
+
"description": "Transpiler",
|
|
5
|
+
"main": "build/src/index.js",
|
|
6
|
+
"typings": "build/src/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/abaplint/transpiler.git"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"compile": "tsc",
|
|
13
|
+
"publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
14
|
+
"publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
15
|
+
"test": "npm run compile && mocha"
|
|
16
|
+
},
|
|
17
|
+
"mocha": {
|
|
18
|
+
"recursive": true,
|
|
19
|
+
"reporter": "progress",
|
|
20
|
+
"spec": "build/test/**/*.js",
|
|
21
|
+
"require": "source-map-support/register"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"ABAP",
|
|
25
|
+
"abaplint"
|
|
26
|
+
],
|
|
27
|
+
"author": "abaplint",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@abaplint/core": "^2.83.23",
|
|
31
|
+
"source-map": "^0.7.3"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/chai": "^4.3.0",
|
|
35
|
+
"@types/mocha": "^9.0.0",
|
|
36
|
+
"chai": "^4.3.4",
|
|
37
|
+
"mocha": "^9.1.3",
|
|
38
|
+
"source-map-support": "^0.5.21",
|
|
39
|
+
"typescript": "^4.5.4"
|
|
40
|
+
}
|
|
41
|
+
}
|