Skip to content

Commit 3f3fec3

Browse files
committed
Add test to check error offset
1 parent ee66fe8 commit 3f3fec3

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

test/errorOffset.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. */
2+
3+
/******************************************************************************
4+
*
5+
* You may not use the identified files except in compliance with the Apache
6+
* License, Version 2.0 (the "License.")
7+
*
8+
* You may obtain a copy of the License at
9+
* http://www.apache.org/licenses/LICENSE-2.0.
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
*
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* The node-oracledb test suite uses 'mocha', 'should' and 'async'.
19+
* See LICENSE.md for relevant licenses.
20+
*
21+
* NAME
22+
* 240. errorOffset.js
23+
*
24+
* DESCRIPTION
25+
* This test verifies a ODPI-C bug fix.
26+
*
27+
*****************************************************************************/
28+
'use strict';
29+
30+
const oracledb = require('oracledb');
31+
const should = require('should');
32+
const dbconfig = require('./dbconfig.js');
33+
34+
describe('240. errorOffset.js', async () => {
35+
36+
it('240.1 checks the offset value of the error', async () => {
37+
let conn;
38+
try {
39+
conn = await oracledb.getConnection(dbconfig);
40+
} catch (error) {
41+
should.not.exist(error);
42+
}
43+
44+
try {
45+
await conn.execute("begin t_Missing := 5; end;");
46+
} catch (error) {
47+
should.exist(error);
48+
should.strictEqual(error.offset, 6);
49+
should.strictEqual(error.errorNum, 6550);
50+
}
51+
52+
try {
53+
await conn.close();
54+
} catch (error) {
55+
should.not.exist(error);
56+
}
57+
});
58+
});

test/list.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4736,3 +4736,6 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
47364736
239.2 prefetchRows is enabled with default value
47374737
239.3 cursor bind OUT then bind IN
47384738
239.4 implicit binding type
4739+
4740+
240. errorOffset.js
4741+
240.1 checks the offset value of the error

test/opts/.mocharc.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,4 +224,5 @@ spec:
224224
- test/nestedCursor05.js
225225
- test/indexedTables01.js
226226
- test/soda14.js
227-
- test/plsqlBindCursorsIN.js
227+
- test/plsqlBindCursorsIN.js
228+
- test/errorOffset.js

0 commit comments

Comments
 (0)