From f7b2bd8039222b31769169e42341a7060e010663 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Sat, 24 Aug 2013 16:05:39 -0500 Subject: [PATCH] Better skipped test handling --- bench/handlebars.js | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/bench/handlebars.js b/bench/handlebars.js index 900bd63c..5e822fb7 100644 --- a/bench/handlebars.js +++ b/bench/handlebars.js @@ -115,16 +115,20 @@ var makeSuite = function(name) { var error = function() { throw new Error("EWOT"); }; - if (dust) { - bench("dust", function() { - dust.render(templateName, context, function(err, out) { }); - }); - } - bench("handlebars", function() { handlebarsTemplates[templateName](context); }); + if (dust) { + if (details.dust) { + bench("dust", function() { + dust.render(templateName, context, function(err, out) { }); + }); + } else { + bench('dust', error); + } + } + if (eco) { if(ecoTemplates[templateName]) { bench("eco", function() { @@ -135,21 +139,28 @@ var makeSuite = function(name) { } } - if (Mustache && mustacheSource) { - bench("mustache", function() { - Mustache.to_html(mustacheSource, context, mustachePartials); - }); - } else { - bench("mustache", error); + if (Mustache) { + if (mustacheSource) { + bench("mustache", function() { + Mustache.to_html(mustacheSource, context, mustachePartials); + }); + } else { + bench("mustache", error); + } } }); } for(var name in benchDetails) { if(benchDetails.hasOwnProperty(name)) { - if (dust) { + if (!benchDetails[name].handlebars) { + continue; + } + + if (dust && benchDetails[name].dust) { dust.loadSource(dust.compile(benchDetails[name].dust, name)); } + handlebarsTemplates[name] = Handlebars.compile(benchDetails[name].handlebars); if (eco && benchDetails[name].eco) {