mirror of
https://github.com/Shopify/liquid.git
synced 2025-11-30 00:00:25 -05:00
UTF8 truncate test
This commit is contained in:
parent
f5d75718e9
commit
f488058789
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@
|
|||||||
pkg
|
pkg
|
||||||
*.rbc
|
*.rbc
|
||||||
.rvmrc
|
.rvmrc
|
||||||
|
.ruby-version
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class Filters
|
class Filters
|
||||||
@ -37,6 +39,7 @@ class StandardFiltersTest < Test::Unit::TestCase
|
|||||||
assert_equal '1234567890', @filters.truncate('1234567890', 20)
|
assert_equal '1234567890', @filters.truncate('1234567890', 20)
|
||||||
assert_equal '...', @filters.truncate('1234567890', 0)
|
assert_equal '...', @filters.truncate('1234567890', 0)
|
||||||
assert_equal '1234567890', @filters.truncate('1234567890')
|
assert_equal '1234567890', @filters.truncate('1234567890')
|
||||||
|
assert_equal "测试...", @filters.truncate("测试测试测试测试", 5)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_strip
|
def test_strip
|
||||||
@ -61,6 +64,7 @@ class StandardFiltersTest < Test::Unit::TestCase
|
|||||||
assert_equal 'one two...', @filters.truncatewords('one two three', 2)
|
assert_equal 'one two...', @filters.truncatewords('one two three', 2)
|
||||||
assert_equal 'one two three', @filters.truncatewords('one two three')
|
assert_equal 'one two three', @filters.truncatewords('one two three')
|
||||||
assert_equal 'Two small (13” x 5.5” x 10” high) baskets fit inside one large basket (13”...', @filters.truncatewords('Two small (13” x 5.5” x 10” high) baskets fit inside one large basket (13” x 16” x 10.5” high) with cover.', 15)
|
assert_equal 'Two small (13” x 5.5” x 10” high) baskets fit inside one large basket (13”...', @filters.truncatewords('Two small (13” x 5.5” x 10” high) baskets fit inside one large basket (13” x 16” x 10.5” high) with cover.', 15)
|
||||||
|
assert_equal "测试测试测试测试", @filters.truncatewords('测试测试测试测试', 5)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_strip_html
|
def test_strip_html
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user