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
diff options
context:
space:
mode:
authorJohannes <johannes.ewald@roomieplanet.de>2012-06-21 02:22:53 +0400
committerJohannes <johannes.ewald@roomieplanet.de>2012-06-21 02:23:07 +0400
commitce972e2b1a9a43f6c19a68a5701b1b3b1bcc67f8 (patch)
treefc1643f6a0d42110ec15fbb823ed58d9f50bd37f /test/detectStrictMode.test.js
parent7d90695d9c413e7ae4745e9def9cf6285cc9f1f2 (diff)
added detectStrictMode-module
Diffstat (limited to 'test/detectStrictMode.test.js')
-rw-r--r--test/detectStrictMode.test.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/detectStrictMode.test.js b/test/detectStrictMode.test.js
new file mode 100644
index 0000000..a154471
--- /dev/null
+++ b/test/detectStrictMode.test.js
@@ -0,0 +1,13 @@
+var expect = require("expect.js"),
+ detectStrictMode = require("../lib/detectStrictMode.js");
+
+describe("detectStrictMode", function () {
+ it("should detect \"use strict\"; at the beginning of a string and ignore all whitespace before", function () {
+ expect(detectStrictMode('"use strict";')).to.be(true);
+ expect(detectStrictMode(' "use strict";')).to.be(true);
+ expect(detectStrictMode(' \n "use strict";')).to.be(true);
+ });
+ it("should not detect \"use strict\"; if it occurs in some nested function", function () {
+ expect(detectStrictMode('function () {"use strict";}')).to.be(false);
+ });
+}); \ No newline at end of file