binary.test 494B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. Twig supports binary operations (+, -, *, /, ~, %, and, or)
  3. --TEMPLATE--
  4. {{ 1 + 1 }}
  5. {{ 2 - 1 }}
  6. {{ 2 * 2 }}
  7. {{ 2 / 2 }}
  8. {{ 3 % 2 }}
  9. {{ 1 and 1 }}
  10. {{ 1 and 0 }}
  11. {{ 0 and 1 }}
  12. {{ 0 and 0 }}
  13. {{ 1 or 1 }}
  14. {{ 1 or 0 }}
  15. {{ 0 or 1 }}
  16. {{ 0 or 0 }}
  17. {{ 0 or 1 and 0 }}
  18. {{ 1 or 0 and 1 }}
  19. {{ "foo" ~ "bar" }}
  20. {{ foo ~ "bar" }}
  21. {{ "foo" ~ bar }}
  22. {{ foo ~ bar }}
  23. {{ 20 // 7 }}
  24. --DATA--
  25. return array('foo' => 'bar', 'bar' => 'foo')
  26. --EXPECT--
  27. 2
  28. 1
  29. 4
  30. 1
  31. 1
  32. 1
  33. 1
  34. 1
  35. 1
  36. 1
  37. foobar
  38. barbar
  39. foofoo
  40. barfoo
  41. 2