From 0ed087d3e0aa3a68cc71c53280882359c1ce0537 Mon Sep 17 00:00:00 2001 From: Sahab Yazdani Date: Sun, 13 Nov 2011 17:16:07 -0500 Subject: [PATCH] Add Unit Tests for format function. --- test/unit.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/unit.js b/test/unit.js index d5c6801..b8b9e4d 100644 --- a/test/unit.js +++ b/test/unit.js @@ -789,4 +789,24 @@ test("Regression Suite", function() { ) , ' Hello ' , 'Change Delimiter + Partial'); +}); + +test("Mustache.format", function() { + equals( + Mustache.format('{{0}} {{1}}, {{2}} {{3}}.', 'And', 'it', 'was', 'good'), + 'And it, was good.', + 'Simple Version' + ); + + equals( + Mustache.format('{{0}}', function() { return 'Groucho Marx'; } ), + 'Groucho Marx', + 'With Functions' + ); + + equals( + Mustache.format('{{0}}'), + '', + 'Insufficient parameters (no failure)' + ); }); \ No newline at end of file