/** * 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 renderFile': function(){ var html = '

tj

', str = '

<%= name %>

', options = { name: 'tj', open: '{', close: '}' }; ejs.renderFile(__dirname + '/fixtures/user.ejs', options, function(err, res){ assert.ok(!err); assert.equal(res, html); }) }, '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('<%= "