UNPKG

785 BJavaScriptView Raw
1var markdown = require('Markdown');
2
3function clone_array( input ) {
4 eval( "var tmp = " + input.toSource() );
5 return tmp;
6}
7
8tests = {
9 test_arguments_untouched: function() {
10 var input = "A [link][id] by id.\n\n[id]: http://google.com",
11 tree = markdown.parse( input ),
12 clone = clone_array( tree );
13
14
15 var output = markdown.toHTML( tree );
16
17 asserts.same( tree, clone, "tree isn't modified" );
18 // We had a problem where we would acidentally remove the references
19 // property from the root. We want to check the output is the same when
20 // called twice.
21 asserts.same( markdown.toHTML( tree ), output, "output is consistent" );
22 }
23}
24
25if (require.main === module) {
26 var asserts = require('test').asserts;
27 require('test').runner(tests);
28}