<commit_before>module("Director.js", {
  setup: function() {
    window.location.hash = "";
    shared = {};
  },
  teardown: function() {
    window.location.hash = "";
    shared = {};
  }
});

var shared;

function createTest(name, config, use, test) {
  if (typeof use === 'function') {
    test = use;
    use = undefined;
  }
  asyncTest(name, function() {
    setTimeout(function() {
      var router = new Router(config),
          context;

      if (use !== undefined) {
        router.configure(use);
      }

      router.init();

      test.call(context = {
        router: router,
        navigate: function(url, callback) {
          window.location.hash = url;
          setTimeout(function() {
            callback.call(context);
          }, 14);
        },
        finish: function() {
          router.destroy();
          start();
        }
      });
    }, 14);
  });
};<commit_msg>HTML5 mode testing needs timeout in the calls because of the timeout used when creating onpopstate method<commit_after>module("Director.js", {
  setup: function() {
    window.location.hash = "";
    shared = {};
  },
  teardown: function() {
    window.location.hash = "";
    shared = {};
  }
});

var shared;

function createTest(name, config, use, test) {
  if (typeof use === 'function') {
    test = use;
    use = undefined;
  }

  var innerTimeout = 0;
  if (HTML5TEST) {
    if (use === undefined) {
      use = {};
    }
    use.html5history = true;
    innerTimeout     = 500; // Because of the use of setTimeout when defining onpopstate
  }

  asyncTest(name, function() {
    setTimeout(function() {
      var router = new Router(config),
          context;

      if (use !== undefined) {
        router.configure(use);
      }

      router.init();

      setTimeout(function() {
        test.call(context = {
          router: router,
          navigate: function(url, callback) {
            if (HTML5TEST) {
              router.setRoute(url);
            } else {
              window.location.hash = url;
            }
            setTimeout(function() {
              callback.call(context);
            }, 14);
          },
          finish: function() {
            router.destroy();
            start();
          }
        })
      }, innerTimeout);
    }, 14);
  });
};
{'fraction_non_alphanumeric': 0.1439756415832971, 'fraction_numerical': 0.006959547629404089, 'mean_word_length': 1.8255528255528255, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5909501', 'n_tokens_mistral': 674, 'n_tokens_neox': 659, 'n_words': 150}