Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Fluid.Tests/StringValueTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,17 @@ public void StringValueCreateNullShouldReturnEmpty()
// Assert
Assert.Equal(StringValue.Empty, stringValue);
}

[Theory]
[InlineData(true)]
[InlineData(false)]
public void StringValue_Create_InitializesProperties(bool encode)
{
var stringValue = StringValue.Create("a", encode);

// Assert
Assert.Equal("a", stringValue.ToStringValue());
Assert.Equal(encode, stringValue.Encode);
}
}
}
4 changes: 2 additions & 2 deletions Fluid/Values/StringValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static StringValue Create(string s)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static StringValue Create(string s, bool encode)
{
return Create(s, encode);
return new StringValue(s, encode);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -93,7 +93,7 @@ public override bool Equals(FluidValue other)
return _value == other.ToStringValue();
}

// Delegating other types
// Delegating other types
if (other == BlankValue.Instance || other == NilValue.Instance || other == EmptyValue.Instance)
{
return other.Equals(this);
Expand Down