Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9597e46

Browse files
committed
Add test for implicit global vars
jhnns#35
1 parentbe744f2 commit9597e46

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

‎test/testModules/implicitGlobal.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
implicitGlobal="this is an implicit global var ..."+
2+
"yes, it's bad coding style but there are still some libs out there";

‎test/testModules/sharedTestCases.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,16 @@ describe("rewire " + (typeof testEnv === "undefined"? "(node)": "(" + testEnv +
248248
}
249249
});
250250

251+
it("should be possible to set implicit globals",function(){
252+
varimplicitGlobalModule=rewire("./implicitGlobal.js");
253+
254+
implicitGlobalModule.__set__("implicitGlobal",true);
255+
expect(implicitGlobalModule.__get__("implicitGlobal")).to.be(true);
256+
// setting implicit global vars will change them globally instead of locally.
257+
// that's a shortcoming of the current implementation which can't be solved easily.
258+
//expect(implicitGlobal).to.be.a("string");
259+
});
260+
251261
it("should throw a TypeError if the path is not a string",function(){
252262
expect(function(){
253263
rewire(null);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp