@@ -103,4 +103,36 @@ describe('Mustache.parse', function () {
103
103
} ) ;
104
104
} ) ;
105
105
106
+ describe ( 'when parsing a template without tags specified followed by the same template with tags specified' , function ( ) {
107
+ it ( 'returns different tokens for the latter parse' , function ( ) {
108
+ var template = "{{foo}}[bar]" ;
109
+ var parsedWithBraces = Mustache . parse ( template ) ;
110
+ var parsedWithBrackets = Mustache . parse ( template , [ '[' , ']' ] ) ;
111
+ assert . notDeepEqual ( parsedWithBrackets , parsedWithBraces ) ;
112
+ } ) ;
113
+ } ) ;
114
+
115
+ describe ( 'when parsing a template with tags specified followed by the same template with different tags specified' , function ( ) {
116
+ it ( 'returns different tokens for the latter parse' , function ( ) {
117
+ var template = "(foo)[bar]" ;
118
+ var parsedWithParens = Mustache . parse ( template , [ '(' , ')' ] ) ;
119
+ var parsedWithBrackets = Mustache . parse ( template , [ '[' , ']' ] ) ;
120
+ assert . notDeepEqual ( parsedWithBrackets , parsedWithParens ) ;
121
+ } ) ;
122
+ } ) ;
123
+
124
+ describe ( 'when parsing a template after already having parsed that template with a different Mustache.tags' , function ( ) {
125
+ it ( 'returns different tokens for the latter parse' , function ( ) {
126
+ var template = "{{foo}}[bar]" ;
127
+ var parsedWithBraces = Mustache . parse ( template , [ '(' , ')' ] ) ;
128
+
129
+ var oldTags = Mustache . tags ;
130
+ Mustache . tags = [ '[' , ']' ] ;
131
+ var parsedWithBrackets = Mustache . parse ( template ) ;
132
+ Mustache . tags = oldTags ;
133
+
134
+ assert . notDeepEqual ( parsedWithBrackets , parsedWithBraces ) ;
135
+ } ) ;
136
+ } ) ;
137
+
106
138
} ) ;
0 commit comments