Skip to content

Commit b14e526

Browse files
committed
Additional tests for issue #70.
1 parent 8372b1a commit b14e526

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

nodejs/scripts/tests/GH70/GH70.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
var Jsonix = require("../../jsonix").Jsonix;
22
var GH70 = require("./Mappings.js").GH70;
33

4+
var context = new Jsonix.Context([GH70], {
5+
namespacePrefixes : {
6+
"urn:GH70" : "gh70"
7+
}
8+
});
9+
410
module.exports = {
511
"Unmarshalls" : {
612
"Expression" : function(test) {
7-
var context = new Jsonix.Context([GH70], {
13+
var nonXsiContext = new Jsonix.Context([GH70], {
814
namespacePrefixes : {
915
"urn:GH70" : "gh70"
1016
},
1117
supportXsiType : false
1218
});
13-
var unmarshaller = context.createUnmarshaller();
19+
var unmarshaller = nonXsiContext.createUnmarshaller();
1420
var data = unmarshaller.unmarshalString('<Expression xmlns="urn:GH70"/>');
15-
test.equal(false, context.supportXsiType);
21+
test.equal(false, nonXsiContext.supportXsiType);
1622
test.equal("GH70.Expression", data.value.TYPE_NAME);
1723
test.done();
1824
},
1925
"Literal" : function(test) {
20-
var context = new Jsonix.Context([GH70], {
21-
namespacePrefixes : {
22-
"urn:GH70" : "gh70"
23-
}
24-
});
2526
var unmarshaller = context.createUnmarshaller();
2627
var data = unmarshaller.unmarshalString('<Literal xmlns="urn:GH70">test</Literal>');
2728
test.equal(true, context.supportXsiType);
@@ -30,17 +31,19 @@ module.exports = {
3031
test.done();
3132
},
3233
"ExpressionAsLiteral" : function(test) {
33-
var context = new Jsonix.Context([GH70], {
34-
namespacePrefixes : {
35-
"urn:GH70" : "gh70"
36-
}
37-
});
3834
var unmarshaller = context.createUnmarshaller();
3935
var data = unmarshaller.unmarshalString('<Expression xmlns="urn:GH70" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Literal">test</Expression>');
4036
test.equal("GH70.Literal", data.value.TYPE_NAME);
4137
test.equal("test", data.value.value);
4238
test.done();
4339
},
40+
"And" : function(test) {
41+
var unmarshaller = context.createUnmarshaller();
42+
var data = unmarshaller.unmarshalString('<And xmlns="urn:GH70"><Expression/><Expression/></And>');
43+
test.equal("GH70.And", data.value.TYPE_NAME);
44+
test.equal(2, data.value.expressions.length);
45+
test.done();
46+
},
4447
},
4548
};
4649
// TODO marshalling

nodejs/scripts/tests/GH70/Mappings.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ var GH70_Module_Factory = function () {
55
tis: [
66
{ ln: 'Expression'},
77
{ ln: 'Literal', bti: '.Expression', ps: [{ n: 'value', t: 'v' }]},
8+
{ ln: 'And', bti: '.Expression', ps: [{ n: 'expressions', en: 'Expression', t: 'e', ti: '.Expression', col: true}]},
89
],
910
eis: [{
1011
en: 'Literal',
1112
ti: '.Literal'
1213
},{
1314
en: 'Expression',
1415
ti: '.Expression'
16+
},{
17+
en: 'And',
18+
ti: '.And'
1519
}]
1620
};
1721
return {

0 commit comments

Comments
 (0)