/
in.test
126 lines (110 loc) · 2.18 KB
/
in.test
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
--TEST--
Twig supports the in operator
--TEMPLATE--
{% if bar in foo %}
TRUE
{% endif %}
{% if not (bar in foo) %}
{% else %}
TRUE
{% endif %}
{% if bar not in foo %}
{% else %}
TRUE
{% endif %}
{% if 'a' in bar %}
TRUE
{% endif %}
{% if 'c' not in bar %}
TRUE
{% endif %}
{% if '' in bar %}
TRUE
{% endif %}
{% if '' in '' %}
TRUE
{% endif %}
{% if '0' not in '' %}
TRUE
{% endif %}
{% if 'a' not in '0' %}
TRUE
{% endif %}
{% if '0' in '0' %}
TRUE
{% endif %}
{{ false in [0, 1] ? 'TRUE' : 'FALSE' }}
{{ true in [0, 1] ? 'TRUE' : 'FALSE' }}
{{ '0' in [0, 1] ? 'TRUE' : 'FALSE' }}
{{ '' in [0, 1] ? 'TRUE' : 'FALSE' }}
{{ 0 in ['', 1] ? 'TRUE' : 'FALSE' }}
{{ '' in 'foo' ? 'TRUE' : 'FALSE' }}
{{ 0 in 'foo' ? 'TRUE' : 'FALSE' }}
{{ false in 'foo' ? 'TRUE' : 'FALSE' }}
{{ false in '100' ? 'TRUE' : 'FALSE' }}
{{ true in '100' ? 'TRUE' : 'FALSE' }}
{{ [] in [true, false] ? 'TRUE' : 'FALSE' }}
{{ [] in [true, ''] ? 'TRUE' : 'FALSE' }}
{{ [] in [true, []] ? 'TRUE' : 'FALSE' }}
{{ resource in 'foo'~resource ? 'TRUE' : 'FALSE' }}
{{ object in 'stdClass' ? 'TRUE' : 'FALSE' }}
{{ [] in 'Array' ? 'TRUE' : 'FALSE' }}
{{ dir_object in 'foo'~dir_object ? 'TRUE' : 'FALSE' }}
{{ ''~resource in resource ? 'TRUE' : 'FALSE' }}
{{ 'stdClass' in object ? 'TRUE' : 'FALSE' }}
{{ 'Array' in [] ? 'TRUE' : 'FALSE' }}
{{ ''~dir_object in dir_object ? 'TRUE' : 'FALSE' }}
{{ resource in [''~resource] ? 'TRUE' : 'FALSE' }}
{{ resource in [resource + 1 - 1] ? 'TRUE' : 'FALSE' }}
{{ dir_object in [''~dir_object] ? 'TRUE' : 'FALSE' }}
{{ 5 in 125 ? 'TRUE' : 'FALSE' }}
{{ 5 in '125' ? 'TRUE' : 'FALSE' }}
{{ '5' in 125 ? 'TRUE' : 'FALSE' }}
{{ '5' in '125' ? 'TRUE' : 'FALSE' }}
{{ 5.5 in 125.5 ? 'TRUE' : 'FALSE' }}
{{ 5.5 in '125.5' ? 'TRUE' : 'FALSE' }}
{{ '5.5' in 125.5 ? 'TRUE' : 'FALSE' }}
--DATA--
return array('bar' => 'bar', 'foo' => array('bar' => 'bar'), 'dir_object' => new SplFileInfo(dirname(__FILE__)), 'object' => new stdClass(), 'resource' => fopen(dirname(__FILE__), 'r'))
--EXPECT--
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
TRUE
FALSE
TRUE
FALSE