From f488058789974e490601ee415faee7cf96b6db4c Mon Sep 17 00:00:00 2001 From: Florian Weingarten Date: Mon, 17 Jun 2013 11:48:03 -0400 Subject: [PATCH] UTF8 truncate test --- .gitignore | 1 + test/liquid/standard_filter_test.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 56e80efe..ebfa0ede 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ pkg *.rbc .rvmrc +.ruby-version diff --git a/test/liquid/standard_filter_test.rb b/test/liquid/standard_filter_test.rb index d47f36cd..0de4ae17 100644 --- a/test/liquid/standard_filter_test.rb +++ b/test/liquid/standard_filter_test.rb @@ -1,3 +1,5 @@ +# encoding: utf-8 + require 'test_helper' class Filters @@ -37,6 +39,7 @@ class StandardFiltersTest < Test::Unit::TestCase assert_equal '1234567890', @filters.truncate('1234567890', 20) assert_equal '...', @filters.truncate('1234567890', 0) assert_equal '1234567890', @filters.truncate('1234567890') + assert_equal "测试...", @filters.truncate("测试测试测试测试", 5) end 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 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 "测试测试测试测试", @filters.truncatewords('测试测试测试测试', 5) end def test_strip_html