File tree Expand file tree Collapse file tree
main/antlr4/com/github/jknack/handlebars/internal
test/java/com/github/jknack/handlebars/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change 337337fragment
338338ID_START
339339 :
340- [a-zA-ZА-Яа-я_$@:\u0001 -\u0009 \u000b\u000c\u000e -\u001E\u00C0 -\u00FF ]
340+ [a-zA-ZА-Яа-я_$@:\u0001 -\u0008 \u000b\u000c\u000e -\u001E\u00C0 -\u00FF ]
341341 ;
342342
343343fragment
Original file line number Diff line number Diff line change 66import org .antlr .v4 .runtime .tree .ParseTree ;
77import org .junit .Test ;
88
9+ import static org .junit .Assert .assertEquals ;
10+
911public class HbsParserTest {
1012
1113 private boolean printTokens = true ;
@@ -118,6 +120,21 @@ public void setDelim() {
118120 parse ("{{=+-+ +-+=}}+-+test+-+" );
119121 }
120122
123+ @ Test
124+ public void whiteSpaceHandledEqually () {
125+ String withSpace = "{{helper param1=\" 1\" param2=2}}" ;
126+ ParseTree tree = parse (withSpace );
127+
128+ String withNewlines = "{{helper\n param1=\" 1\" \n param2=2}}" ;
129+ assertEquals ("Newlines should be treated the same as spaces" , tree .getText (), parse (withNewlines ).getText ());
130+
131+ String withDosNewlines = "{{helper\r \n param1=\" 1\" \r \n param2=2}}" ;
132+ assertEquals ("DOS-style newlines should be treated the same as spaces" , tree .getText (), parse (withDosNewlines ).getText ());
133+
134+ String alignedWithTabs = "{{helper\n \t param1=\" 1\" \n \t param2=2}}" ;
135+ assertEquals ("Tab-aligned variables should be treated the same as spaces" , tree .getText (), parse (alignedWithTabs ).getText ());
136+ }
137+
121138 private ParseTree parse (final String input ) {
122139 return parse (input , "{{" , "}}" );
123140 }
You can’t perform that action at this time.
0 commit comments