File: trim.test

package info (click to toggle)
php-twig 3.5.1-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,560 kB
  • sloc: php: 17,829; makefile: 106; sh: 42
file content (36 lines) | stat: -rw-r--r-- 856 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--TEST--
"trim" filter
--TEMPLATE--
{{ "  I like Twig.  "|trim }}
{{ text|trim }}
{{ "  foo/"|trim("/") }}
{{ "xxxI like Twig.xxx"|trim(character_mask="x", side="left") }}
{{ "xxxI like Twig.xxx"|trim(side="right", character_mask="x") }}
{{ "xxxI like Twig.xxx"|trim("x", "right") }}
{{ "/  foo/"|trim("/", "left") }}
{{ "/  foo/"|trim(character_mask="/", side="left") }}
{{ "  do nothing.  "|trim("", "right") }}
*{{ ""|trim }}*
*{{ ""|trim("", "left") }}*
*{{ ""|trim("", "right") }}*
*{{ null|trim }}*
*{{ null|trim("", "left") }}*
*{{ null|trim("", "right") }}*
--DATA--
return ['text' => "  If you have some <strong>HTML</strong> it will be escaped.  "]
--EXPECT--
I like Twig.
If you have some &lt;strong&gt;HTML&lt;/strong&gt; it will be escaped.
  foo
I like Twig.xxx
xxxI like Twig.
xxxI like Twig.
  foo/
  foo/
  do nothing.  
**
**
**
**
**
**