# -*-perl-*- use strict; use Test::More 'no_plan'; use lib "$ENV{LJHOME}/cgi-bin"; require 'ljlib.pl'; { my $test_string = qq {
hellohellohello
}; my $test_string_trunc = $test_string; $test_string_trunc =~ s/hellohellohello/hello/; is(LJ::html_trim($test_string, 10), $test_string_trunc, "Truncating with html works"); is(LJ::html_trim("hello", 2), "he", "Truncating normal text"); $test_string = qq {
123456789
}; $test_string_trunc = qq {
123}; is(LJ::html_trim($test_string, 3), $test_string_trunc, "Truncating with poorly-formed HTML"); } 1;