Skip to content

Commit b1f58ed

Browse files
Fishrock123evanlucas
authored andcommitted
test: abstract skip functionality to common
The tap skipping output is so prevalent yet obscure in nature that we ought to move it into it's own function in test/common.js PR-URL: #6697 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
1 parent 7d3f575 commit b1f58ed

File tree

229 files changed

+300
-304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+300
-304
lines changed

‎test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ const assert = require('assert');
88
// v8::String::kMaxLength defined in v8.h
99
constkStringMaxLength=process.binding('buffer').kStringMaxLength;
1010

11-
constskipMessage=
12-
'1..0 # Skipped: intensive toString tests due to memory confinements';
11+
constskipMessage='intensive toString tests due to memory confinements';
1312
if(!common.enoughTestMem){
14-
console.log(skipMessage);
13+
common.skip(skipMessage);
1514
return;
1615
}
1716

@@ -20,13 +19,13 @@ try{
2019
}catch(e){
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if(e.message!=='Array buffer allocation failed')throw(e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if(!binding.ensureAllocation(2*kStringMaxLength)){
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

‎test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
constbinding=require('./build/Release/binding');
55
constassert=require('assert');
66

7-
constskipMessage=
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
constskipMessage='intensive toString tests due to memory confinements';
98
if(!common.enoughTestMem){
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try{
2019
}catch(e){
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if(e.message!=='Array buffer allocation failed')throw(e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if(!binding.ensureAllocation(2*kStringMaxLength)){
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

‎test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
constbinding=require('./build/Release/binding');
55
constassert=require('assert');
66

7-
constskipMessage=
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
constskipMessage='intensive toString tests due to memory confinements';
98
if(!common.enoughTestMem){
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try{
2019
}catch(e){
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if(e.message!=='Array buffer allocation failed')throw(e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if(!binding.ensureAllocation(2*kStringMaxLength)){
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

‎test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
constbinding=require('./build/Release/binding');
55
constassert=require('assert');
66

7-
constskipMessage=
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
constskipMessage='intensive toString tests due to memory confinements';
98
if(!common.enoughTestMem){
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try{
2019
}catch(e){
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if(e.message!=='Array buffer allocation failed')throw(e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if(!binding.ensureAllocation(2*kStringMaxLength)){
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

‎test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
constbinding=require('./build/Release/binding');
55
constassert=require('assert');
66

7-
constskipMessage=
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
constskipMessage='intensive toString tests due to memory confinements';
98
if(!common.enoughTestMem){
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try{
2019
}catch(e){
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if(e.message!=='Array buffer allocation failed')throw(e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if(!binding.ensureAllocation(2*kStringMaxLength)){
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

‎test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
constbinding=require('./build/Release/binding');
55
constassert=require('assert');
66

7-
constskipMessage=
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
constskipMessage='intensive toString tests due to memory confinements';
98
if(!common.enoughTestMem){
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try{
2019
}catch(e){
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if(e.message!=='Array buffer allocation failed')throw(e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if(!binding.ensureAllocation(2*kStringMaxLength)){
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

‎test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
constbinding=require('./build/Release/binding');
55
constassert=require('assert');
66

7-
constskipMessage=
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
constskipMessage='intensive toString tests due to memory confinements';
98
if(!common.enoughTestMem){
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try{
2019
}catch(e){
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if(e.message!=='Array buffer allocation failed')throw(e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if(!binding.ensureAllocation(2*kStringMaxLength)){
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

‎test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ const common = require('../../common');
44
constbinding=require('./build/Release/binding');
55
constassert=require('assert');
66

7-
constskipMessage=
8-
'1..0 # Skipped: intensive toString tests due to memory confinements';
7+
constskipMessage='intensive toString tests due to memory confinements';
98
if(!common.enoughTestMem){
10-
console.log(skipMessage);
9+
common.skip(skipMessage);
1110
return;
1211
}
1312

@@ -20,13 +19,13 @@ try{
2019
}catch(e){
2120
// If the exception is not due to memory confinement then rethrow it.
2221
if(e.message!=='Array buffer allocation failed')throw(e);
23-
console.log(skipMessage);
22+
common.skip(skipMessage);
2423
return;
2524
}
2625

2726
// Ensure we have enough memory available for future allocations to succeed.
2827
if(!binding.ensureAllocation(2*kStringMaxLength)){
29-
console.log(skipMessage);
28+
common.skip(skipMessage);
3029
return;
3130
}
3231

‎test/common.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,9 @@ exports.fail = function(msg){
465465
assert.fail(null,null,msg);
466466
};
467467

468+
exports.skip=function(msg){
469+
console.log(`1..0 # Skipped: ${msg}`);
470+
};
468471

469472
// A stream to push an array into a REPL
470473
functionArrayStream(){

‎test/disabled/tls_server.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var certPem = fs.readFileSync(common.fixturesDir + '/cert.pem');
1313
try{
1414
varcredentials=crypto.createCredentials({key: keyPem,cert: certPem});
1515
}catch(e){
16-
console.log('1..0 # Skipped: node compiled without OpenSSL.');
16+
common.skip('node compiled without OpenSSL.');
1717
return;
1818
}
1919
vari=0;

0 commit comments

Comments
(0)