<commit_before>/*
 Copyright 2015 - 2017 by <NAME>

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

(function(factory) {
  "use strict";

  var dependencies = ["chai", "../_testUtil", "../../src/_private/util", "./stacks"];

  if (typeof define === 'function' && define.amd) {
    dependencies.push("module");
    define(dependencies, factory);
  }
  else if (typeof exports === 'object') {
    module.exports = factory.apply(undefined, dependencies.map(function(d) {return require(d);}));
  }
}(function(chai, testUtil, util, stacks, amdModule) {
  "use strict";

  var expect = chai.expect;

  var fileName = (typeof module === "object") ? module.filename : util.browserModuleLocation(amdModule);
  var contractLibTestPath = util.dirname(util.dirname(fileName));
  var getGlobal = new Function("return this;");

  function generateMutableStuff() {
    //noinspection JSPrimitiveTypeWrapperUsage,JSHint
    var result = [
      {subject: {a: 4}, expected: "object"},
      {subject: [1, 2, 3], expected: "array"},
      {subject: function() {}, expected: "function"},
      {subject: new ReferenceError(), expected: "error"},
      {subject: new Date(), expected: "date"},
      {subject: /a-z/, expected: "regexp"},
      {subject: new Number(4), expected: "number"},
      {subject: new String("abc"), expected: "string"},
      {subject: new String(""), expected: "string"},
      {subject: new Boolean(true), expected: "boolean"},
      {subject: arguments, expected: "arguments"}
    ];
    result.forEach(function(r) {r.isPrimitive = false;});
    return result;
  }

  //noinspection JSPrimitiveTypeWrapperUsage,JSHint
  var stuff = [
    {subject: undefined, expected: "undefined", isPrimitive: false},
    {subject: null, expected: "null", isPrimitive: false},
    {subject: Math, expected: "math", isPrimitive: false},
    {subject: JSON, expected: "json", isPrimitive: false},
    {subject: "abc", expected: "string", isPrimitive: true},
    {subject: "", expected: "string", isPrimitive: true},
    {subject: 4, expected: "number", isPrimitive: true},
    {subject: false, expected: "boolean", isPrimitive: true},
    {subject: getGlobal(), expected: "object", isPrimitive: false}
  ].concat(generateMutableStuff());

  function describeLocationTest(propertyName, environments) {
    describe("#" + propertyName, function() {
      it("is a RegExp", function() {
        expect(util).to.have.property(propertyName).that.is.instanceof(RegExp);
      });
      Object.keys(stacks).forEach(function(env) {
        var lines = stacks[env]
          .split(util.eol)
          .forEach(function(l) {
          if (0 <= environments.indexOf(env)) {
            it("matches the " + env + " stack line \"" + l + "\"", function() {
              expect(expect(l).to.match(util[propertyName]));
            });
          }
          else {
            it("does not match the " + env + " stack line \"" + l + "\"", function() {
              expect(expect(l).to.not.match(util[propertyName]));
            });
          }
        });
      });
    });
  }

  var atLocationEnvironments = ["node", "chrome"];
  var ATLocationEnvironments = ["firefox", "safari"];
  (0 <= atLocationEnvironments.indexOf(testUtil.environment) ? atLocationEnvironments : ATLocationEnvironments)
    .push("current environment");

  // describe("_private", function() {
    describe("_private/util", function() {

      describe("#eol", function() {
        it("is a string", function() {
          expect(util.eol).to.be.a("string");
          testUtil.log("eol: start>" + util.eol + "<end" );
        });
      });

      describeLocationTest("atStackLocation", atLocationEnvironments);
      describeLocationTest("@StackLocation", ATLocationEnvironments);

      describe("#stackLocation", function() {
        it("is a RegExp", function() {
          expect(util).to.have.property("stackLocation").that.is.instanceof(RegExp);
        });
        var lines = stacks["current environment"]
          .split(util.eol)
          .forEach(function(l) {
            it("matches the current environment stack line \"" + l + "\"", function() {
              expect(expect(l).to.match(util.stackLocation));
            });
          });<commit_msg>Firefox adds an extra empty line. Fix the test.<commit_after>/*
 Copyright 2015 - 2017 by <NAME>

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

(function(factory) {
  "use strict";

  var dependencies = ["chai", "../_testUtil", "../../src/_private/util", "./stacks"];

  if (typeof define === 'function' && define.amd) {
    dependencies.push("module");
    define(dependencies, factory);
  }
  else if (typeof exports === 'object') {
    module.exports = factory.apply(undefined, dependencies.map(function(d) {return require(d);}));
  }
}(function(chai, testUtil, util, stacks, amdModule) {
  "use strict";

  var expect = chai.expect;

  var fileName = (typeof module === "object") ? module.filename : util.browserModuleLocation(amdModule);
  var contractLibTestPath = util.dirname(util.dirname(fileName));
  var getGlobal = new Function("return this;");

  function generateMutableStuff() {
    //noinspection JSPrimitiveTypeWrapperUsage,JSHint
    var result = [
      {subject: {a: 4}, expected: "object"},
      {subject: [1, 2, 3], expected: "array"},
      {subject: function() {}, expected: "function"},
      {subject: new ReferenceError(), expected: "error"},
      {subject: new Date(), expected: "date"},
      {subject: /a-z/, expected: "regexp"},
      {subject: new Number(4), expected: "number"},
      {subject: new String("abc"), expected: "string"},
      {subject: new String(""), expected: "string"},
      {subject: new Boolean(true), expected: "boolean"},
      {subject: arguments, expected: "arguments"}
    ];
    result.forEach(function(r) {r.isPrimitive = false;});
    return result;
  }

  //noinspection JSPrimitiveTypeWrapperUsage,JSHint
  var stuff = [
    {subject: undefined, expected: "undefined", isPrimitive: false},
    {subject: null, expected: "null", isPrimitive: false},
    {subject: Math, expected: "math", isPrimitive: false},
    {subject: JSON, expected: "json", isPrimitive: false},
    {subject: "abc", expected: "string", isPrimitive: true},
    {subject: "", expected: "string", isPrimitive: true},
    {subject: 4, expected: "number", isPrimitive: true},
    {subject: false, expected: "boolean", isPrimitive: true},
    {subject: getGlobal(), expected: "object", isPrimitive: false}
  ].concat(generateMutableStuff());

  function describeLocationTest(propertyName, environments) {
    describe("#" + propertyName, function() {
      it("is a RegExp", function() {
        expect(util).to.have.property(propertyName).that.is.instanceof(RegExp);
      });
      Object.keys(stacks).forEach(function(env) {
        var lines = stacks[env]
          .split(util.eol)
          .filter(function(l) {return l;}) // some environments add an empty line at the end of the stack
          .forEach(function(l) {
          if (0 <= environments.indexOf(env)) {
            it("matches the " + env + " stack line \"" + l + "\"", function() {
              expect(expect(l).to.match(util[propertyName]));
            });
          }
          else {
            it("does not match the " + env + " stack line \"" + l + "\"", function() {
              expect(expect(l).to.not.match(util[propertyName]));
            });
          }
        });
      });
    });
  }

  var atLocationEnvironments = ["node", "chrome"];
  var ATLocationEnvironments = ["firefox", "safari"];
  (0 <= atLocationEnvironments.indexOf(testUtil.environment) ? atLocationEnvironments : ATLocationEnvironments)
    .push("current environment");

  // describe("_private", function() {
    describe("_private/util", function() {

      describe("#eol", function() {
        it("is a string", function() {
          expect(util.eol).to.be.a("string");
          testUtil.log("eol: start>" + util.eol + "<end" );
        });
      });

      describeLocationTest("atStackLocation", atLocationEnvironments);
      describeLocationTest("@StackLocation", ATLocationEnvironments);

      describe("#stackLocation", function() {
        it("is a RegExp", function() {
          expect(util).to.have.property("stackLocation").that.is.instanceof(RegExp);
        });
        var lines = stacks["current environment"]
          .split(util.eol)
          .filter(function(l) {return l;}) // some environments add an empty line at the end of the stack
          .forEach(function(l) {
            it("matches the current environment stack line \"" + l + "\"", function() {
              expect(expect(l).to.match(util.stackLocation));
            });
          });
{'fraction_non_alphanumeric': 0.15562913907284767, 'fraction_numerical': 0.0041390728476821195, 'mean_word_length': 3.2113289760348582, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2338607', 'n_tokens_mistral': 2737, 'n_tokens_neox': 2688, 'n_words': 742}