var assert = require('assert');
var freetree = require('../freetree');

describe('#parse', function() {
    it('should parse 0 level tree', function() {
	var str = '#abc';
	var tree = freetree.parse(str);
        assert.ok(tree.level == 0);
	assert.ok(tree.value == 'abc');
	assert.ok(tree.nodes == undefined);
    });

    it('should parse 1 level tree', function() {
	var str = '#abc\r\n##def\r\n##xyz';
	var tree = freetree.parse(str);
        assert.ok(tree.level == 0);
	assert.ok(tree.value == 'abc');
	assert.ok(tree.nodes.length == 2);
    });

    it('should parse 2 level tree', function() {
	var str = '#abc\r\n##def\r\n###123\r\n##xyz';
	var tree = freetree.parse(str);
        assert.ok(tree.level == 0);
	assert.ok(tree.value == 'abc');
	assert.ok(tree.nodes.length == 2);
	assert.ok(tree.nodes[0].nodes[0].value == '123');
    });
});

@@ -838,13 +838,734 @@
 %0A    %7D);
+%0A%0A    it('should parse 2 level tree with custom leading character', function() %7B%0A%09var str = '@abc%5Cr%5Cn@@def%5Cr%5Cn@@@123%5Cr%5Cn@@xyz';%0A%09var tree = freetree.parse(str, %7BleadingChar: '@'%7D);%0A        assert.ok(tree.level == 0);%0A%09assert.ok(tree.value == 'abc');%0A%09assert.ok(tree.nodes.length == 2);%0A%09assert.ok(tree.nodes%5B0%5D.nodes%5B0%5D.value == '123');%0A    %7D);%0A%0A    it('should parse 2 level tree with regular expression control character as leading character', function() %7B%0A%09var str = '*abc%5Cr%5Cn**def%5Cr%5Cn***123%5Cr%5Cn**xyz';%0A%09var tree = freetree.parse(str, %7BleadingChar: '*'%7D);%0A        assert.ok(tree.level == 0);%0A%09assert.ok(tree.value == 'abc');%0A%09assert.ok(tree.nodes.length == 2);%0A%09assert.ok(tree.nodes%5B0%5D.nodes%5B0%5D.value == '123');%0A    %7D);
 %0A%7D);%0A

add test cases for testing custom leading characters