Skip to content

Commit 3594e96

Browse files
Wrong alignment error
+1 test
1 parent 83b941f commit 3594e96

File tree

7 files changed

+30
-11
lines changed

7 files changed

+30
-11
lines changed

dist/quick-erd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ class de {
739739
e.rearrangeDiagram(3, !1), this.paperScroller.centerContent();
740740
}
741741
}
742-
const ue = "1.2.1", fe = {
742+
const ue = "1.2.2", fe = {
743743
Diagram: de,
744744
version: ue
745745
};

dist/quick-erd.umd.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/quick-sql.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8914,7 +8914,7 @@ function Se(d) {
89148914
}
89158915
let x = null;
89168916
for (let b in I)
8917-
(x == null || I[x] <= I[b]) && (x = b);
8917+
(x == null || I[x] <= I[b]) && (x = parseInt(b));
89188918
return x;
89198919
}
89208920
function te(d) {
@@ -9219,7 +9219,7 @@ function Ee(d, h) {
92199219
return new Y(d, h).getErrors();
92209220
}
92219221
function le() {
9222-
return "1.2.1";
9222+
return "1.2.2";
92239223
}
92249224
Y.version = le;
92259225
Y.toDDL = Pe;

dist/quick-sql.umd.cjs

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@oracle/quicksql",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "Quick SQL to DDL and ERD translator",
55
"main": "./dist/quick-sql.umd.cjs",
66
"module": "./dist/quick-sql.js",

src/errorMsgs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function guessIndent( lines ) {
165165
let indent = null;
166166
for( let i in frequencies ) {
167167
if( indent == null || frequencies[indent] <= frequencies[i] )
168-
indent = i;
168+
indent = parseInt(i);
169169
}
170170
return indent;
171171

test/error_msg_tests.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import {quicksql,toErrors} from "../src/ddl.js";
22
import errorMsgs from '../src/errorMsgs.js'
33

4+
var assertionCnt = 0;
45

56
function checkError(msgList, line, offset, msg) {
7+
assertionCnt++;
68
for( const i in msgList ) {
79
if( msgList[i].from.line == line && msgList[i].from.depth == offset && msgList[i].message == msg ) {
810
return;
@@ -12,17 +14,19 @@ function checkError(msgList, line, offset, msg) {
1214
}
1315

1416
export function checkNoError(msgList, msgPrefix) {
17+
assertionCnt++;
1518
for( const i in msgList ) {
1619
if( msgList[i].message.indexOf(msgPrefix) == 0 ) {
17-
throw new Error('Test failed for "'+msg);
20+
throw new Error('Test failed: extra error "'+msgPrefix+'"');
1821
}
1922
}
2023
}
2124

25+
var output;
2226

2327
export default function error_msg_tests() {
2428

25-
let output =toErrors(`dept
29+
output =toErrors(`dept
2630
id
2731
`);
2832
checkError(output, 1, 4, errorMsgs.messages.duplicateId);
@@ -63,7 +67,22 @@ view customer_view customer
6367
`).getErrors();
6468
checkError(output, 3, 4, errorMsgs.messages.misalignedAttribute+"3");
6569

70+
output = new quicksql(`dept
71+
name
72+
emp
73+
name
74+
`).getErrors();
75+
checkNoError(output, errorMsgs.messages.misalignedAttribute);
76+
77+
6678
}
6779

80+
error_msg_tests();
81+
82+
console.log(assertionCnt);
6883

69-
error_msg_tests();
84+
const minimalTestCnt = 10;
85+
if( assertionCnt < minimalTestCnt ) {
86+
console.error("assertionCnt < "+minimalTestCnt);
87+
throw new Error('Test failed');
88+
}

0 commit comments

Comments
 (0)