Permalink
Browse files

Add a test against parameter mutation

  • Loading branch information...
1 parent 0441cb2 commit 415255710517905ec4c85d3bca7196d02c2f1547 @evilstreak evilstreak committed Jan 17, 2010
Showing with 23 additions and 0 deletions.
  1. +23 −0 test/interface.t.js
View
@@ -0,0 +1,23 @@
+var markdown = require('Markdown');
+
+function clone_array( input ) {
+ eval( "var tmp = " + input.toSource() );
+ return tmp;
+}
+
+tests = {
+ test_arguments_untouched: function() {
+ var input = "A [link][id] by id.\n\n[id]: http://google.com",
+ tree = markdown.parse( input ),
+ clone = clone_array( tree ),
+ output = markdown.toHTML( tree );
+
+ asserts.same( tree, clone, "tree isn't modified" );
+ asserts.same( markdown.toHTML( tree ), output, "output is consistent" );
+ }
+}
+
+if (require.main === module) {
+ var asserts = require('test').asserts;
+ require('test').runner(tests);
+}

0 comments on commit 4152557

Please sign in to comment.