<commit_before>var assert = require('assert');
var unindent = require('..');

it("should unindent tab-indented code", function () {
	var code = [
		'	a',
		'		b',
		'	  c'
	].join('\n');
	var unindented = [
		'a',
		'	b',
		'  c'
	].join('\n');

	assert.equal(unindent(code), unindented);
});

it("should unindent space-indented code", function () {
	var code = [
		'  a',
		'  	b',
		'    c'
	].join('\n');
	var unindented = [
		'a',
		'	b',
		'  c'
	].join('\n');

	assert.equal(unindent(code), unindented);
});

it("should be able to convert tabs in code", function () {
	var code = [
		'	a',
		'		b',
		'	  c'
	].join('\n');
	var unindented = [
		'a',
		'    b',
		'  c'
	].join('\n');

	assert.equal(unindent(code, { tabSize: 4 }), unindented);
});

it("should ignore leading new lines", function () {
	var code = [
		'',
		'	a',
		'		b',
		'	  c'<commit_msg>(- test) Testing mid-line hard-tab support<commit_after>var assert = require('assert');
var unindent = require('..');

it("should unindent tab-indented code", function () {
	var code = [
		'	a',
		'		b',
		'	  c'
	].join('\n');
	var unindented = [
		'a',
		'	b',
		'  c'
	].join('\n');

	assert.equal(unindent(code), unindented);
});

it("should unindent space-indented code", function () {
	var code = [
		'  a',
		'  	b',
		'    c'
	].join('\n');
	var unindented = [
		'a',
		'	b',
		'  c'
	].join('\n');

	assert.equal(unindent(code), unindented);
});

it("should be able to convert leading tabs in code", function () {
	var code = [
		'	a',
		'		b',
		'	  c'
	].join('\n');
	var unindented = [
		'a',
		'    b',
		'  c'
	].join('\n');

	assert.equal(unindent(code, { tabSize: 4 }), unindented);
});

it("should ignore tabs mid-line when converting", function () {
	var code = [
		'	a',
		'		b	',
		'	  c'
	].join('\n');
	var unindented = [
		'a',
		'    b	',
		'  c'
	].join('\n');

	assert.equal(unindent(code, { tabSize: 4 }), unindented);
});

it("should ignore leading new lines", function () {
	var code = [
		'',
		'	a',
		'		b',
		'	  c'
{'fraction_non_alphanumeric': 0.23210735586481113, 'fraction_numerical': 0.0014910536779324055, 'mean_word_length': 2.6666666666666665, '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': '4173109', 'n_tokens_mistral': 915, 'n_tokens_neox': 866, 'n_words': 188}