<commit_before>var
	promix = require('../index.js');

function queue ( promise, value ) {
	setTimeout(function ( ) {
		promise.fulfill(value);
	}, 0);
}

function pop ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).pop().then(function ( result ) {
		test.equals(result, 3);
		test.done();
	});
	queue(promise, [1, 2, 3]);
}

function push ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).push(4).then(function ( result ) {
		test.equals(result, 4);
		test.done();
	});
	queue(promise, [1, 2, 3]);
}

function reverse ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).reverse().pop().then(function ( result ) {
		test.equals(result, 1);
		test.done();
	});
	queue(promise, [1, 2, 3]);
}

function shift ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).shift().then(function ( result ) {
		test.equals(result, 1);
		test.done();
	});
	queue(promise, [1, 2, 3]);
}

function sort ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).sort().pop().then(function ( result ) {
		test.equals(result, 'c');
		test.done();
	});
	queue(promise, ['c', 'a', 'b']);
}

function splice ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).splice(0, 1).then(function ( result ) {
		test.equals(result, 10);
		test.done();
	});
	queue(promise, [10, 5, 7]);
}

function unshift ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).unshift(2).then(function ( result ) {
		test.equals(result, 4);
		test.done();
	});
	queue(promise, [10, 5, 7]);
}

function concat ( test ) {
	var
		promise = promix.promise(),
		string_promise = promix.promise();

	test.expect(2);
	promix.toArray(promise).concat(2).pop().then(function ( result ) {
		test.equals(result, 2);
	});
	promix.toArray(['foo']).concat(string_promise).concat('baz', 'wat').join(' ').then(function ( result ) {
		test.equals(result, 'foo bar baz wat');
		test.done();
	});
	queue(promise, [10, 5, 7]);
	setTimeout(function ( ) {
		string_promise.fulfill('bar');
	}, 10);<commit_msg>Better testing for ArrayPromise.concat().<commit_after>var
	promix = require('../index.js');

function queue ( promise, value ) {
	setTimeout(function ( ) {
		promise.fulfill(value);
	}, 0);
}

function pop ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).pop().then(function ( result ) {
		test.equals(result, 3);
		test.done();
	});
	queue(promise, [1, 2, 3]);
}

function push ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).push(4).then(function ( result ) {
		test.equals(result, 4);
		test.done();
	});
	queue(promise, [1, 2, 3]);
}

function reverse ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).reverse().pop().then(function ( result ) {
		test.equals(result, 1);
		test.done();
	});
	queue(promise, [1, 2, 3]);
}

function shift ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).shift().then(function ( result ) {
		test.equals(result, 1);
		test.done();
	});
	queue(promise, [1, 2, 3]);
}

function sort ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).sort().pop().then(function ( result ) {
		test.equals(result, 'c');
		test.done();
	});
	queue(promise, ['c', 'a', 'b']);
}

function splice ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).splice(0, 1).then(function ( result ) {
		test.equals(result, 10);
		test.done();
	});
	queue(promise, [10, 5, 7]);
}

function unshift ( test ) {
	var
		promise = promix.promise();

	promix.toArray(promise).unshift(2).then(function ( result ) {
		test.equals(result, 4);
		test.done();
	});
	queue(promise, [10, 5, 7]);
}

function concat ( test ) {
	var
		promise = promix.promise(),
		string_promise_one = promix.promise(),
		string_promise_two = promix.promise();

	test.expect(2);
	promix.toArray(promise).concat(2).pop().then(function ( result ) {
		test.equals(result, 2);
	});
	promix.toArray(string_promise_one).concat(string_promise_two).concat('baz', 'wat').join(' ').then(function ( result ) {
		test.equals(result, 'foo bar baz wat');
		test.done();
	});
	queue(promise, [10, 5, 7]);
	setTimeout(function ( ) {
		string_promise_two.fulfill('bar');
	}, 10);
	setTimeout(function ( ) {
		string_promise_one.fulfill('foo');
	}, 20);
{'fraction_non_alphanumeric': 0.20315765033666125, 'fraction_numerical': 0.01950313443231948, 'mean_word_length': 4.080188679245283, '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': '7086479', 'n_tokens_mistral': 1792, 'n_tokens_neox': 1650, 'n_words': 299}