Skip to content

Commit

Permalink
2.8.24: bugfix, integer rounding from char (#1432)
Browse files Browse the repository at this point in the history
  • Loading branch information
larshp committed Apr 14, 2024
1 parent 9fa8227 commit 8008674
Show file tree
Hide file tree
Showing 10 changed files with 286 additions and 264 deletions.
384 changes: 192 additions & 192 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Expand Up @@ -189,10 +189,10 @@
"@abaplint/core": "^2.106.5",
"@types/chai": "^4.3.14",
"@types/mocha": "^10.0.6",
"@types/node": "^20.12.3",
"@types/node": "^20.12.7",
"@types/sql.js": "^1.4.9",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.6.0",
"chai": "^4.4.1",
"cross-fetch": "^4.0.0",
"dotenv": "^16.4.5",
Expand All @@ -202,10 +202,10 @@
"mocha": "^10.4.0",
"pg": "^8.11.5",
"pg-cursor": "^2.10.5",
"snowflake-sdk": "^1.10.0",
"snowflake-sdk": "^1.10.1",
"source-map-support": "^0.5.21",
"sql.js": "^1.10.2",
"temporal-polyfill": "^0.2.3",
"typescript": "^5.4.3"
"temporal-polyfill": "^0.2.4",
"typescript": "^5.4.5"
}
}
46 changes: 23 additions & 23 deletions packages/cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@abaplint/transpiler-cli",
"version": "2.8.23",
"version": "2.8.24",
"description": "Transpiler - Command Line Interface",
"funding": "https://github.com/sponsors/larshp",
"bin": {
Expand All @@ -26,15 +26,15 @@
"author": "abaplint",
"license": "MIT",
"devDependencies": {
"@abaplint/transpiler": "^2.8.23",
"@abaplint/transpiler": "^2.8.24",
"@types/glob": "^8.1.0",
"glob": "=7.2.0",
"@types/progress": "^2.0.7",
"@types/node": "^20.12.3",
"@types/node": "^20.12.7",
"@abaplint/core": "^2.106.5",
"progress": "^2.0.3",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"typescript": "^5.4.3"
"typescript": "^5.4.5"
}
}
48 changes: 24 additions & 24 deletions packages/runtime/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/runtime/package.json
@@ -1,6 +1,6 @@
{
"name": "@abaplint/runtime",
"version": "2.8.23",
"version": "2.8.24",
"description": "Transpiler - Runtime",
"main": "build/src/index.js",
"typings": "build/src/index.d.ts",
Expand Down Expand Up @@ -34,9 +34,9 @@
"chai": "^4.4.1",
"mocha": "^10.4.0",
"source-map-support": "^0.5.21",
"typescript": "^5.4.3"
"typescript": "^5.4.5"
},
"dependencies": {
"temporal-polyfill": "^0.2.3"
"temporal-polyfill": "^0.2.4"
}
}
2 changes: 1 addition & 1 deletion packages/runtime/src/types/integer.ts
Expand Up @@ -25,7 +25,7 @@ export function toInteger(value: string, exception = true): number {
throw new Error("CONVT_NO_NUMBER");
}
}
return parseInt(value, 10);
return Math.round(parseFloat(value));
}

export class Integer implements INumeric {
Expand Down
18 changes: 9 additions & 9 deletions packages/transpiler/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/transpiler/package.json
@@ -1,6 +1,6 @@
{
"name": "@abaplint/transpiler",
"version": "2.8.23",
"version": "2.8.24",
"description": "Transpiler",
"main": "build/src/index.js",
"typings": "build/src/index.d.ts",
Expand Down Expand Up @@ -38,6 +38,6 @@
"chai": "^4.4.1",
"mocha": "^10.4.0",
"source-map-support": "^0.5.21",
"typescript": "^5.4.3"
"typescript": "^5.4.5"
}
}
22 changes: 22 additions & 0 deletions test/types/integer.ts
Expand Up @@ -150,4 +150,26 @@ describe("Running Examples - Integer type", () => {
await f(abap);
expect(abap.console.get()).to.equal("FFEF6E");
});

it("rounding from char, up", async () => {
const code = `
DATA lv_date_int TYPE i.
lv_date_int = '45141.58832'.
WRITE / lv_date_int.`;
const js = await run(code);
const f = new AsyncFunction("abap", js);
await f(abap);
expect(abap.console.get()).to.equal("45142");
});

it("rounding from char, down", async () => {
const code = `
DATA lv_date_int TYPE i.
lv_date_int = '45141.48832'.
WRITE / lv_date_int.`;
const js = await run(code);
const f = new AsyncFunction("abap", js);
await f(abap);
expect(abap.console.get()).to.equal("45141");
});
});

0 comments on commit 8008674

Please sign in to comment.