Liquid new array filters test harness

Rendered at: 2026-02-20 21:49:09

Template: list-collections


0) Basic custom arrays (strings only)

str_arr: ["alpha","beta","gamma","Alpha","ALPHA","foo bar","foo_bar","123"]

num_str_arr: ["1","2","3","10","20","30"]

mixed_arr: ["true","false","","0","1","Alpha"]

0.0) Numeric coercion sanity check (strings -> numbers)

[s="1" => (s | plus: 0)=1] [s="2" => (s | plus: 0)=2] [s="3" => (s | plus: 0)=3] [s="10" => (s | plus: 0)=10] [s="20" => (s | plus: 0)=20] [s="30" => (s | plus: 0)=30]

0.1) find / find_index / has on string arrays

find with numeric property (0, "alpha"): null

find_index with numeric property (0, "alpha"): null

has with numeric property (0, "alpha"): false

find substring-ish (property="alp", target="alp"): "alpha"

reject substring-ish (property="foo", target="foo"): ["alpha","beta","gamma","Alpha","ALPHA","123"]

0.2) reject on string arrays (indexing style)

reject first-char=="a" (property=0, target="a"): ["beta","gamma","Alpha","ALPHA","foo bar","foo_bar","123"]

find 1-arg (property="alp"): "alpha"

find_index 1-arg (property="alp"): 0

has 1-arg (property="alp"): true

where 1-arg (property="alp"): ["alpha"]

reject 1-arg (property="alp"): ["beta","gamma","Alpha","ALPHA","foo bar","foo_bar","123"]


1) Product + variants tests (uses first product from first collection if possible)

test_collection: 2020-Classes

test_product: nil

variants count: n/a



2) Filters object tests (lightweight, guarded)

filters exists?: false

filters.size: n/a

first_filter.label: nil

3) Nested property string tests (metafields-ish dotted path)

dotted where: "metafields.custom.badge.value", "New" => size: 0

dotted find => nil


4) Empty input tests

empty array: ""

find on empty => null

find_index on empty => null

has on empty => false

reject on empty => [""]


5) Dot-path property argument tests (variant.product.handle)

No product available to test dot-path properties.


END FILTER TEST HARNESS


Collections

2020-Classes
2020-Classes

2020-Classes

Available in Different Colors
Loafers

Available in Different Colors

discountTest
Loafers

discountTest

discountTestTwo
Shoe

discountTestTwo

Featured products

Featured products

Home page

Home page

Newest products
Loafers

Newest products

nose rings

nose rings

Products
Products

Products

Products
Gift Shoe

Products

Tools and Materials
Tools and Materials

Tools and Materials