summaryrefslogtreecommitdiff
path: root/test/parallel/test-buffer.js
diff options
context:
space:
mode:
authorJohan Bergström <bugs@bergstroem.nu>2015-03-04 12:11:21 +1100
committerShigeki Ohtsu <ohtsu@iij.ad.jp>2015-03-05 10:31:41 +0900
commit671fbd5a9de03c5ede968ef6c6b365965a546a55 (patch)
tree771b3158d781911def96ffbd50bd9d4cad4b0077 /test/parallel/test-buffer.js
parentc7ad320472d69962b48e10e564682f24dd31d1d1 (diff)
downloadnode-new-671fbd5a9de03c5ede968ef6c6b365965a546a55.tar.gz
test: refactor all tests that depends on crypto
we had a few ways versions of looking for support before executing a test. this commit unifies them as well as add the check for all tests that previously lacked them. found by running `./configure --without-ssl && make test`. also, produce tap skip output if the test is skipped. PR-URL: https://github.com/iojs/io.js/pull/1049 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
Diffstat (limited to 'test/parallel/test-buffer.js')
-rw-r--r--test/parallel/test-buffer.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/test/parallel/test-buffer.js b/test/parallel/test-buffer.js
index 1c2c425090..f4e89e2a57 100644
--- a/test/parallel/test-buffer.js
+++ b/test/parallel/test-buffer.js
@@ -1108,16 +1108,20 @@ assert.throws(function () {
new SlowBuffer(smalloc.kMaxLength + 1);
}, RangeError);
-// Test truncation after decode
-var crypto = require('crypto');
-
-var b1 = new Buffer('YW55=======', 'base64');
-var b2 = new Buffer('YW55', 'base64');
-
-assert.equal(
- crypto.createHash('sha1').update(b1).digest('hex'),
- crypto.createHash('sha1').update(b2).digest('hex')
-);
+if (common.hasCrypto) {
+ // Test truncation after decode
+ var crypto = require('crypto');
+
+ var b1 = new Buffer('YW55=======', 'base64');
+ var b2 = new Buffer('YW55', 'base64');
+
+ assert.equal(
+ crypto.createHash('sha1').update(b1).digest('hex'),
+ crypto.createHash('sha1').update(b2).digest('hex')
+ );
+} else {
+ console.log('1..0 # Skipped: missing crypto');
+}
// Test Compare
var b = new Buffer(1).fill('a');