-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strict Liquid Syntax (Part 2) + Render Performance (#441)
* Updated Capitalize filter to be inline with Reference Library. * Idea discussed and originally developed by @robin-parker * Render performance rewrite * Whitespace control handling changes, resolves #411 * Remove non-standard short-hand notation for comments and literal tags. See Shopify/liquid@f85bea2 * PR code review changes to syntax - no functional changes * Address PR review + additional code coverage * Resolves #413 * Implements SortNatural Filter and changes Sort to be case-sensitive in line with spec * Code formatting changes per PR review
- Loading branch information
Showing
21 changed files
with
899 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using NUnit.Framework; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace DotLiquid.Tests | ||
{ | ||
[TestFixture] | ||
public class ExtendedFilterTests | ||
{ | ||
private Context _context; | ||
|
||
[OneTimeSetUp] | ||
public void SetUp() | ||
{ | ||
_context = new Context(CultureInfo.InvariantCulture); | ||
Template.RegisterFilter(typeof(ExtendedFilters)); | ||
} | ||
|
||
[Test] | ||
public void TestTitleize() | ||
{ | ||
var context = _context; | ||
Assert.AreEqual(null, ExtendedFilters.Titleize(context: context, input: null)); | ||
Assert.AreEqual("", ExtendedFilters.Titleize(context: context, input: "")); | ||
Assert.AreEqual(" ", ExtendedFilters.Titleize(context: context, input: " ")); | ||
Assert.AreEqual("That Is One Sentence.", ExtendedFilters.Titleize(context: context, input: "That is one sentence.")); | ||
|
||
Helper.AssertTemplateResult( | ||
expected: "Title", | ||
template: "{{ 'title' | titleize }}"); | ||
} | ||
|
||
[Test] | ||
public void TestUpcaseFirst() | ||
{ | ||
var context = _context; | ||
Assert.AreEqual(null, ExtendedFilters.UpcaseFirst(context: context, input: null)); | ||
Assert.AreEqual("", ExtendedFilters.UpcaseFirst(context: context, input: "")); | ||
Assert.AreEqual(" ", ExtendedFilters.UpcaseFirst(context: context, input: " ")); | ||
Assert.AreEqual(" My boss is Mr. Doe.", ExtendedFilters.UpcaseFirst(context: context, input: " my boss is Mr. Doe.")); | ||
|
||
Helper.AssertTemplateResult( | ||
expected: "My great title", | ||
template: "{{ 'my great title' | upcase_first }}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.