mirror of https://github.com/webpack/webpack.git
add test cases for #3235
This commit is contained in:
parent
a58ce33c2f
commit
e4dfd201f1
|
|
@ -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");
|
||||
|
|
@ -61,4 +72,7 @@ it("should define process.env.DEFINED_NESTED_KEY", function() {
|
|||
var x = env.DEFINED_NESTED_KEY;
|
||||
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");
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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\""
|
||||
})
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue