UNPKG

621 BJavaScriptView Raw
1var grunt = require('../../lib/grunt');
2
3exports['template'] = {
4 'process': function(test) {
5 test.expect(4);
6 var obj = {
7 foo: 'c',
8 bar: 'b<%= foo %>d',
9 baz: 'a<%= bar %>e'
10 };
11
12 test.equal(grunt.template.process('<%= foo %>', obj), 'c', 'should retrieve value.');
13 test.equal(grunt.template.process('<%= bar %>', obj), 'bcd', 'should recurse.');
14 test.equal(grunt.template.process('<%= baz %>', obj), 'abcde', 'should recurse.');
15
16 obj.foo = '<% oops %';
17 test.equal(grunt.template.process('<%= baz %>', obj), 'ab<% oops %de', 'should not explode.');
18 test.done();
19 }
20};