<commit_before>var test = require('tape'); // require('tap').test; // tape works in browserify, tap works in node 0.10
var shimmedKeys = require('./index.js');
var is = require('is-extended');
var keys = require('./shim.js');

test('works', function (t) {
	var obj = {
		"str": "boz",
		"obj": {},
		"arr": [],
		"bool": true,
		"num": 42,
		"null": null,
		"undefined": undefined
	};
	var objKeys = ['str', 'obj', 'arr', 'bool', 'num', 'null', 'undefined'];

	t.test('exports a function', function (st) {
		st.plan(1);
		if (Object.keys) {
			st.equal(Object.keys, shimmedKeys, 'Object.keys is supported and exported');
		} else {
			st.equal(keys, shimmedKeys, 'Object.keys is not supported; shim is exported');
		}
	});

	t.test('working with actual shim', function (st) {
		st.plan(1);
		st.notEqual(Object.keys, keys, 'keys shim is not native Object.keys');
	});

	t.test('works with an object literal', function (st) {
		st.plan(2);
		var theKeys = keys(obj);
		st.equal(is.isArray(theKeys), true, 'returns an array');
		st.deepEqual(theKeys, objKeys, 'Object has expected keys');
	});

	t.test('returns names which are own properties', function (st) {
		keys(obj).forEach(function (name) {
			st.equal(obj.hasOwnProperty(name), true);
		});
		st.end();
	});

	t.test('returns names which are enumerable', function (st) {
		var k, loopedValues = [];
		for (k in obj) {
			loopedValues.push(k);
		}
		keys(obj).forEach(function (name) {
			st.notEqual(loopedValues.indexOf(name), -1, name + ' is not enumerable');
		});
		st.end();
	});

	t.test('throws an error for a non-object', function (st) {
		st.plan(1);
		st.throws(function () {
			return keys(42);
		}, new RangeError(), 'throws on a non-object');
	});
	t.end();
});

test('works with an object instance', function (t) {
	var Prototype = function () {};
	Prototype.prototype.foo = true;
	var obj = new Prototype();
	obj.bar = true;
	var theKeys = keys(obj);
	t.equal(is.isArray(theKeys), true, 'returns an array');
	t.deepEqual(theKeys, ['bar'], 'Instance has expected keys');
	t.end();
});
<commit_msg>Using explicit end instead of plan.<commit_after>var test = require('tape'); // require('tap').test; // tape works in browserify, tap works in node 0.10
var shimmedKeys = require('./index.js');
var is = require('is-extended');
var keys = require('./shim.js');

test('works', function (t) {
	var obj = {
		"str": "boz",
		"obj": {},
		"arr": [],
		"bool": true,
		"num": 42,
		"null": null,
		"undefined": undefined
	};
	var objKeys = ['str', 'obj', 'arr', 'bool', 'num', 'null', 'undefined'];

	t.test('exports a function', function (st) {
		if (Object.keys) {
			st.equal(Object.keys, shimmedKeys, 'Object.keys is supported and exported');
		} else {
			st.equal(keys, shimmedKeys, 'Object.keys is not supported; shim is exported');
		}
		st.end();
	});

	t.test('working with actual shim', function (st) {
		st.notEqual(Object.keys, keys, 'keys shim is not native Object.keys');
		st.end();
	});

	t.test('works with an object literal', function (st) {
		var theKeys = keys(obj);
		st.equal(is.isArray(theKeys), true, 'returns an array');
		st.deepEqual(theKeys, objKeys, 'Object has expected keys');
		st.end();
	});

	t.test('returns names which are own properties', function (st) {
		keys(obj).forEach(function (name) {
			st.equal(obj.hasOwnProperty(name), true);
		});
		st.end();
	});

	t.test('returns names which are enumerable', function (st) {
		var k, loopedValues = [];
		for (k in obj) {
			loopedValues.push(k);
		}
		keys(obj).forEach(function (name) {
			st.notEqual(loopedValues.indexOf(name), -1, name + ' is not enumerable');
		});
		st.end();
	});

	t.test('throws an error for a non-object', function (st) {
		st.throws(function () {
			return keys(42);
		}, RangeError, 'throws on a non-object');
		st.end();
	});
	t.end();
});

test('works with an object instance', function (t) {
	var Prototype = function () {};
	Prototype.prototype.foo = true;
	var obj = new Prototype();
	obj.bar = true;
	var theKeys = keys(obj);
	t.equal(is.isArray(theKeys), true, 'returns an array');
	t.deepEqual(theKeys, ['bar'], 'Instance has expected keys');
	t.end();
});

{'fraction_non_alphanumeric': 0.19377413127413126, 'fraction_numerical': 0.004826254826254826, 'mean_word_length': 3.9463007159904535, 'pattern_counts': {'":': 14, '<': 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': '839043', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1456, 'n_words': 402}