<commit_before>var tap = require('../tap');

tap.count(5);

setTimeout(function () {
  tap.ok(this == global, '"this" value in timer is global object');
  tap.ok(true, 'console.log of global works #TODO');
  // console.log(this)
}, 10);

var id = setInterval(function () {
  tap.ok(false, 'error, interval was not cancelled');
  process.exit(1);
}, 100)
clearInterval(id);

console.log('# timeout id:', id)

var count = 0;
var jk = setInterval(function () {
	count++;
	clearInterval(jk);
	if (count > 1) {
		tap.ok(false, 'error, interval was not cancelled from inside interval')
		process.exit(1)
	}
}, 0)

setImmediate(function (arg1, arg2, arg3) {
	tap.ok(arg1 != null, 'args passed into callback');
	tap.ok(arg2 == null, 'null args allowed in callback');
	tap.ok(arg3 != null, 'null args allowed in callback');
}, 5, null, 6)<commit_msg>Simplifies timers test to not rely on correct "this" value.<commit_after>var tap = require('../tap');

tap.count(3);

var source = setTimeout(function () {
  // TODO this test differs between Node and browser.
  // tap.ok(this == source, '"this" value in timer is timer return value');
}, 10);

var id = setInterval(function () {
  tap.ok(false, 'error, interval was not cancelled');
  process.exit(1);
}, 100)
clearInterval(id);

console.log('# timeout id:', id)

var count = 0;
var jk = setInterval(function () {
	count++;
	clearInterval(jk);
	if (count > 1) {
		tap.ok(false, 'error, interval was not cancelled from inside interval')
		process.exit(1)
	}
}, 0)

setImmediate(function (arg1, arg2, arg3) {
	tap.ok(arg1 != null, 'args passed into callback');
	tap.ok(arg2 == null, 'null args allowed in callback');
	tap.ok(arg3 != null, 'null args allowed in callback');
}, 5, null, 6)
{'fraction_non_alphanumeric': 0.1696583671105964, 'fraction_numerical': 0.022003474232773594, 'mean_word_length': 4.34984520123839, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2185105', 'n_tokens_mistral': 624, 'n_tokens_neox': 586, 'n_words': 186}