'use strict';
var assert = require('assert');
var strip = require('./strip-json-comments');

suite('Test Cases', function () {
	test('should strip comments', function () {
		assert.strictEqual(strip('//comment\n{"a":"b"}'), '\n{"a":"b"}');
		assert.strictEqual(strip('/*//comment*/{"a":"b"}'), '{"a":"b"}');
		assert.strictEqual(strip('{"a":"b"//comment\n}'), '{"a":"b"\n}');
		assert.strictEqual(strip('{"a":"b"/*comment*/}'), '{"a":"b"}');
		assert.strictEqual(strip('{"a"/*\n\n\ncomment\r\n*/:"b"}'), '{"a":"b"}');
	});

	test('should not strip comments inside strings', function () {
		assert.strictEqual(strip('{"a":"b//c"}'), '{"a":"b//c"}');
		assert.strictEqual(strip('{"a":"b/*c*/"}'), '{"a":"b/*c*/"}');
		assert.strictEqual(strip('{"/*a":"b"}'), '{"/*a":"b"}');
		assert.strictEqual(strip('{"\\"/*a":"b"}'), '{"\\"/*a":"b"}');
	});

	test('should consider escaped slashes when checking for escaped string quote', function () {
		assert.strictEqual(strip('{"\\\\":"https://foobar.com"}'), '{"\\\\":"https://foobar.com"}');
		assert.strictEqual(strip('{"foo\\\"":"https://foobar.com"}'), '{"foo\\\"":"https://foobar.com"}');
	});

	suite('Line endings', function () {
		test('no comments', function () {
			assert.strictEqual(strip('{"a":"b"\n}'), '{"a":"b"\n}');
			assert.strictEqual(strip('{"a":"b"\r\n}'), '{"a":"b"\r\n}');
		});

		test('single line comment', function () {
			assert.strictEqual(strip('{"a":"b"//c\n}'), '{"a":"b"\n}');
			assert.strictEqual(strip('{"a":"b"//c\r\n}'), '{"a":"b"\r\n}');
		});

		test('single line block comment', function () {
			assert.strictEqual(strip('{"a":"b"/*c*/\n}'), '{"a":"b"\n}');
			assert.strictEqual(strip('{"a":"b"/*c*/\r\n}'), '{"a":"b"\r\n}');
		});

		test('multi line block comment', function () {
			assert.strictEqual(strip('{"a":"b",/*c\nc2*/"x":"y"\n}'), '{"a":"b","x":"y"\n}');
			assert.strictEqual(strip('{"a":"b",/*c\r\nc2*/"x":"y"\r\n}'), '{"a":"b","x":"y"\r\n}');
		});
	});
});

@@ -503,32 +503,177 @@
 , '%7B%22a%22:%22b%22%7D');%0A
+%09%09assert.strictEqual(strip('/*!%5Cn * comment%5Cn */%5Cn%7B%22a%22:%22b%22%7D'), '%5Cn%7B%22a%22:%22b%22%7D');%0A%09%09assert.strictEqual(strip('%7B/*comment*/%22a%22:%22b%22%7D'), '%7B%22a%22:%22b%22%7D');%0A
 %09%7D);%0A%0A%09test('sho

Add extra comment tests