Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0eb3ed5

Browse filesBrowse files
Matt Loringjasnell
authored andcommitted
test: reduce brittleness of tab complete test
test-repl-tab-complete includes tests that ensure that certain keys do not appear in tab completions or that completion does not crash the repl. It performed these tests by comparing completion output to a hardcoded list of expected keys. This list is made incorrect by any api changes that occur when new versions of V8 are introduced. With this change, we assert that the specific keys to be avoided are not present in the output instead. PR-URL: #5772 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent a38d6ad commit 0eb3ed5
Copy full SHA for 0eb3ed5

File tree

Expand file treeCollapse file tree

1 file changed

+6
-77
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-77
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-repl-tab-complete.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-repl-tab-complete.js
+6-77Lines changed: 6 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -226,97 +226,26 @@ putIn.run([
226226
'var proxy = new Proxy({}, {ownKeys: () => { throw new Error(); }});'
227227
]);
228228

229-
const proxyElements = [ [
230-
'proxy.__defineGetter__',
231-
'proxy.__defineSetter__',
232-
'proxy.__lookupGetter__',
233-
'proxy.__lookupSetter__',
234-
'proxy.__proto__',
235-
'proxy.constructor',
236-
'proxy.hasOwnProperty',
237-
'proxy.isPrototypeOf',
238-
'proxy.propertyIsEnumerable',
239-
'proxy.toLocaleString',
240-
'proxy.toString',
241-
'proxy.valueOf' ],
242-
'proxy.' ];
243-
244229
testMe.complete('proxy.', common.mustCall(function(error, data) {
245230
assert.strictEqual(error, null);
246-
assert.deepEqual(data, proxyElements);
247231
}));
248232

249233
// Make sure tab completion does not include integer members of an Array
250-
var array_elements = [ [
251-
'ary.__defineGetter__',
252-
'ary.__defineSetter__',
253-
'ary.__lookupGetter__',
254-
'ary.__lookupSetter__',
255-
'ary.__proto__',
256-
'ary.constructor',
257-
'ary.hasOwnProperty',
258-
'ary.isPrototypeOf',
259-
'ary.propertyIsEnumerable',
260-
'ary.toLocaleString',
261-
'ary.toString',
262-
'ary.valueOf',
263-
'',
264-
'ary.concat',
265-
'ary.copyWithin',
266-
'ary.entries',
267-
'ary.every',
268-
'ary.fill',
269-
'ary.filter',
270-
'ary.find',
271-
'ary.findIndex',
272-
'ary.forEach',
273-
'ary.includes',
274-
'ary.indexOf',
275-
'ary.join',
276-
'ary.keys',
277-
'ary.lastIndexOf',
278-
'ary.length',
279-
'ary.map',
280-
'ary.pop',
281-
'ary.push',
282-
'ary.reduce',
283-
'ary.reduceRight',
284-
'ary.reverse',
285-
'ary.shift',
286-
'ary.slice',
287-
'ary.some',
288-
'ary.sort',
289-
'ary.splice',
290-
'ary.unshift' ],
291-
'ary.'];
292-
293234
putIn.run(['.clear']);
294235

295236
putIn.run(['var ary = [1,2,3];']);
296237
testMe.complete('ary.', common.mustCall(function(error, data) {
297-
assert.deepEqual(data, array_elements);
238+
assert.strictEqual(data[0].indexOf('ary.0'), -1);
239+
assert.strictEqual(data[0].indexOf('ary.1'), -1);
240+
assert.strictEqual(data[0].indexOf('ary.2'), -1);
298241
}));
299242

300243
// Make sure tab completion does not include integer keys in an object
301-
var obj_elements = [ [
302-
'obj.__defineGetter__',
303-
'obj.__defineSetter__',
304-
'obj.__lookupGetter__',
305-
'obj.__lookupSetter__',
306-
'obj.__proto__',
307-
'obj.constructor',
308-
'obj.hasOwnProperty',
309-
'obj.isPrototypeOf',
310-
'obj.propertyIsEnumerable',
311-
'obj.toLocaleString',
312-
'obj.toString',
313-
'obj.valueOf',
314-
'',
315-
'obj.a' ],
316-
'obj.' ];
317244
putIn.run(['.clear']);
318245
putIn.run(['var obj = {1:"a","1a":"b",a:"b"};']);
319246

320247
testMe.complete('obj.', common.mustCall(function(error, data) {
321-
assert.deepEqual(data, obj_elements);
248+
assert.strictEqual(data[0].indexOf('obj.1'), -1);
249+
assert.strictEqual(data[0].indexOf('obj.1a'), -1);
250+
assert.notStrictEqual(data[0].indexOf('obj.a'), -1);
322251
}));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.