Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohannes Ewald <mail@johannesewald.de>2013-03-02 19:41:37 +0400
committerJohannes Ewald <mail@johannesewald.de>2013-03-02 19:41:37 +0400
commitf5fd56e1e22a733fb06c7b3f05d1b78d2f630a3b (patch)
tree6072b99d4ca13b916882ce9ae998699240835b2e /test
parent1a807a540f052f8fdd7bd5b8225b460f80b6c65f (diff)
- added a test for the case where a comment is on the last line
Diffstat (limited to 'test')
-rw-r--r--test/testModules/emptyModule.js4
-rw-r--r--test/testModules/sharedTestCases.js6
2 files changed, 10 insertions, 0 deletions
diff --git a/test/testModules/emptyModule.js b/test/testModules/emptyModule.js
index 7c9ad5d..b9a0f90 100644
--- a/test/testModules/emptyModule.js
+++ b/test/testModules/emptyModule.js
@@ -1 +1,5 @@
"use strict"; // run code in ES5 strict mode
+
+var someVar;
+
+// Comment on file end. Hope this won't break anything \ No newline at end of file
diff --git a/test/testModules/sharedTestCases.js b/test/testModules/sharedTestCases.js
index 6001797..eb0c8c9 100644
--- a/test/testModules/sharedTestCases.js
+++ b/test/testModules/sharedTestCases.js
@@ -145,6 +145,12 @@ describe("rewire " + (typeof testEnv === "undefined"? "(node)": "(" + testEnv +
}
}
});
+ it("should not be a problem to have a comment on file end", function () {
+ var rewired = rewire("./emptyModule.js");
+
+ rewired.__set__("someVar", "hello");
+ expect(rewired.__get__("someVar")).to.be("hello");
+ });
it("should not influence the original require if nothing has been required within the rewired module", function () {
rewire("./emptyModule.js"); // nothing happens here because emptyModule doesn't require anything
expect(require("./moduleA.js").__set__).to.be(undefined); // if restoring the original node require didn't worked, the module would have a setter