add test cases for #3235

This commit is contained in:
Tobias Koppers 2016-11-10 08:52:00 +01:00
parent a58ce33c2f
commit e4dfd201f1
2 changed files with 19 additions and 3 deletions

View File

@ -40,6 +40,17 @@ it("should define OBJECT.SUB.CODE", function() {
sub.CODE.should.be.eql(3);
}(OBJECT.SUB));
});
it("should define OBJECT.SUB.STRING", function() {
(typeof OBJECT.SUB.STRING).should.be.eql("string");
OBJECT.SUB.STRING.should.be.eql("string");
if(OBJECT.SUB.STRING !== "string") require("fail");
if(typeof OBJECT.SUB.STRING !== "string") require("fail");
(function(sub) {
// should not crash
sub.STRING.should.be.eql("string");
}(OBJECT.SUB));
});
it("should define process.env.DEFINED_NESTED_KEY", function() {
(process.env.DEFINED_NESTED_KEY).should.be.eql(5);
(typeof process.env.DEFINED_NESTED_KEY).should.be.eql("number");
@ -62,3 +73,6 @@ it("should define process.env.DEFINED_NESTED_KEY", function() {
x.should.be.eql(5);
}(process.env));
});
it("should define process.env.DEFINED_NESTED_KEY_STRING", function() {
if(process.env.DEFINED_NESTED_KEY_STRING !== "string") require("fail");
})

View File

@ -13,10 +13,12 @@ module.exports = {
UNDEFINED: undefined,
FUNCTION: function(a) { return a + 1; },
CODE: "(1+2)",
REGEXP: /abc/i
REGEXP: /abc/i,
STRING: JSON.stringify("string")
}
},
"process.env.DEFINED_NESTED_KEY": 5
"process.env.DEFINED_NESTED_KEY": 5,
"process.env.DEFINED_NESTED_KEY_STRING": "\"string\""
})
]
}