From 625adb81a33a4333d24c442fe818d029cd319cf6 Mon Sep 17 00:00:00 2001 From: Rick Fletcher Date: Tue, 23 Feb 2010 23:41:51 -0800 Subject: [PATCH] Added tests for templates with regex-significant characters in their delimiters --- test/utility.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/utility.js b/test/utility.js index 763a48036..8314c7017 100644 --- a/test/utility.js +++ b/test/utility.js @@ -55,6 +55,19 @@ $(document).ready(function() { var customQuote = _.template("It's its, not it's"); equals(customQuote({}), "It's its, not it's"); + _.templateSettings = { + start : '', + interpolate : /<\?=(.+?)\?>/g + }; + + var customWithSpecialChars = _.template(""); + result = customWithSpecialChars({people : {moe : "Moe", larry : "Larry", curly : "Curly"}}); + equals(result, "", 'can run arbitrary javascript in templates'); + + var customWithSpecialCharsQuote = _.template("It's its, not it's"); + equals(customWithSpecialCharsQuote({}), "It's its, not it's"); + _.templateSettings = { start : '{{', end : '}}',