Files
Twig/tests/Fixtures/expressions/binary.test
2024-10-01 20:43:59 +02:00

59 lines
609 B
Plaintext

--TEST--
Twig supports binary operations (+, -, *, /, ~, %, and, xor, or)
--TEMPLATE--
{{ 1 + 1 }}
{{ 2 - 1 }}
{{ 2 * 2 }}
{{ 2 / 2 }}
{{ 3 % 2 }}
{{ 1 and 1 }}
{{ 1 and 0 }}
{{ 0 and 1 }}
{{ 0 and 0 }}
{{ 1 or 1 }}
{{ 1 or 0 }}
{{ 0 or 1 }}
{{ 0 or 0 }}
{{ 0 or 1 and 0 }}
{{ 1 or 0 and 1 }}
{{ 1 xor 1 }}
{{ 1 xor 0 }}
{{ 0 xor 1 }}
{{ 0 xor 0 }}
{{ 0 and 1 or 1 xor 1 }}
{{ 0 and 1 or 0 xor 1 }}
{{ "foo" ~ "bar" }}
{{ foo ~ "bar" }}
{{ "foo" ~ bar }}
{{ foo ~ bar }}
{{ 20 // 7 }}
--DATA--
return ['foo' => 'bar', 'bar' => 'foo']
--EXPECT--
2
1
4
1
1
1
1
1
1
1
1
1
1
foobar
barbar
foofoo
barfoo
2