File tree Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -364,14 +364,14 @@ public async Task ShouldOnlyAllowInheritedMember()
364364 }
365365
366366 [ Fact ]
367- public async Task ShouldEvaluateStringIndex ( )
367+ public async Task StringIndexerReturnsNil ( )
368368 {
369- _parser . TryParse ( "{{ x[1] } }" , out var template , out var error ) ;
369+ _parser . TryParse ( "{% if x[0] == blank %}true{% else %}false{% endif % }" , out var template , out var error ) ;
370370 var context = new TemplateContext ( ) ;
371371 context . SetValue ( "x" , "abc" ) ;
372372
373373 var result = await template . RenderAsync ( context ) ;
374- Assert . Equal ( "b " , result ) ;
374+ Assert . Equal ( "true " , result ) ;
375375 }
376376
377377 [ Fact ]
Original file line number Diff line number Diff line change @@ -103,13 +103,7 @@ public override bool Equals(FluidValue other)
103103
104104 protected override FluidValue GetIndex ( FluidValue index , TemplateContext context )
105105 {
106- var i = ( int ) index . ToNumberValue ( ) ;
107-
108- if ( i < _value . Length )
109- {
110- return Create ( _value [ i ] ) ;
111- }
112-
106+ // Indexer on string values should return nil.
113107 return NilValue . Instance ;
114108 }
115109
You can’t perform that action at this time.
0 commit comments