Skip to content

Commit 19437aa

Browse files
committed
test: add undefined test
1 parent fc2ca82 commit 19437aa

File tree

4 files changed

+40
-20
lines changed

4 files changed

+40
-20
lines changed

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
sudo: false
12
language: node_js
23
node_js:
3-
- 'iojs-1'
4+
- '4'
5+
- '3'
6+
- '2'
7+
- '1'
48
- '0.12'
59
- '0.11'
610
- '0.10'
7-
script: "make test-travis"
11+
script: "npm run test-cov"
812
after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"

Makefile

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
TESTS = test/*.test.js
22
REPORTER = spec
3-
TIMEOUT = 5000
3+
TIMEOUT = 10000
44
MOCHA_OPTS =
55

66
install:
@@ -26,19 +26,6 @@ test-cov cov: install
2626
$(MOCHA_OPTS) \
2727
$(TESTS)
2828

29-
test-travis: install
30-
@NODE_ENV=test node \
31-
node_modules/.bin/istanbul cover --preserve-comments \
32-
./node_modules/.bin/_mocha \
33-
--report lcovonly \
34-
-- \
35-
--reporter dot \
36-
--timeout $(TIMEOUT) \
37-
$(MOCHA_OPTS) \
38-
$(TESTS)
39-
40-
test-all: test test-cov jshint
41-
4229
benchmark:
4330
@node benchmark/encode.js
4431
@node benchmark/decode.js

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"lib/"
99
],
1010
"scripts": {
11-
"test": "make test-all"
11+
"test": "make test",
12+
"test-cov": "make test-cov"
1213
},
1314
"repository": {
1415
"type": "git",

test/array.test.js

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/**!
2-
* hessian.js - test/array.test.js
3-
*
4-
* Copyright(c) 2014-2015
2+
* Copyright(c) node-modules and other contributors.
53
* MIT Licensed
64
*
75
* Authors:
@@ -33,6 +31,21 @@ describe('array.test.js', function () {
3331
a.should.eql([null, [1]]);
3432
});
3533

34+
it('should write undefined v1', function () {
35+
var b = hessian.encode([
36+
{
37+
$class: '[java.lang.Integer',
38+
$: undefined
39+
},
40+
{
41+
$class: '[java.lang.Integer',
42+
$: [1]
43+
}
44+
]);
45+
var a = hessian.decode(b);
46+
a.should.eql([null, [1]]);
47+
});
48+
3649
it('should write null v2', function () {
3750
var b = hessian.encode([
3851
{
@@ -47,4 +60,19 @@ describe('array.test.js', function () {
4760
var a = hessian.decode(b, '2.0');
4861
a.should.eql([null, [1]]);
4962
});
63+
64+
it('should write undefined v2', function () {
65+
var b = hessian.encode([
66+
{
67+
$class: '[java.lang.Integer',
68+
$: undefined
69+
},
70+
{
71+
$class: '[java.lang.Integer',
72+
$: [1]
73+
}
74+
], '2.0');
75+
var a = hessian.decode(b, '2.0');
76+
a.should.eql([null, [1]]);
77+
});
5078
});

0 commit comments

Comments
 (0)