/** * Module dependencies. */ var ejs = require('../') , assert = require('assert'); module.exports = { 'test .version': function(){ assert.ok(/^\d+\.\d+\.\d+$/.test(ejs.version), 'Test .version format'); }, 'test html': function(){ assert.equal('

yay

', ejs.render('

yay

')); }, 'test buffered code': function(){ var html = '

tj

', str = '

<%= name %>

', locals = { name: 'tj' }; assert.equal(html, ejs.render(str, { locals: locals })); }, 'test unbuffered code': function(){ var html = '

tj

', str = '<% if (name) { %>

<%= name %>

<% } %>', locals = { name: 'tj' }; assert.equal(html, ejs.render(str, { locals: locals })); }, 'test `scope` option': function(){ var html = '

tj

', str = '

<%= this %>

'; assert.equal(html, ejs.render(str, { scope: 'tj' })); }, 'test escaping': function(){ assert.equal('<script>', ejs.render('<%= "