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

detectStrictMode.test.js « test - github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dad674c68c6335eb1c4a162cd6013336bb789289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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";') === true).to.be(true);
        expect(detectStrictMode('      "use strict";') === true).to.be(true);
        expect(detectStrictMode('  \n "use strict";') === true).to.be(true);
    });
    it("should not detect \"use strict\"; if it occurs in some nested function", function () {
        expect(detectStrictMode('function () {"use strict";}') === false).to.be(true);
    });
});