--TEST--
"defined" test
--TEMPLATE--
{{ definedVar                     is     defined ? 'ok' : 'ko' }}
{{ definedVar                     is not defined ? 'ko' : 'ok' }}
{{ undefinedVar                   is     defined ? 'ko' : 'ok' }}
{{ undefinedVar                   is not defined ? 'ok' : 'ko' }}
{{ zeroVar                        is     defined ? 'ok' : 'ko' }}
{{ nullVar                        is     defined ? 'ok' : 'ko' }}
{{ nested.definedVar              is     defined ? 'ok' : 'ko' }}
{{ nested['definedVar']           is     defined ? 'ok' : 'ko' }}
{{ nested.definedVar              is not defined ? 'ko' : 'ok' }}
{{ nested.undefinedVar            is     defined ? 'ko' : 'ok' }}
{{ nested['undefinedVar']         is     defined ? 'ko' : 'ok' }}
{{ nested.undefinedVar            is not defined ? 'ok' : 'ko' }}
{{ nested.zeroVar                 is     defined ? 'ok' : 'ko' }}
{{ nested.nullVar                 is     defined ? 'ok' : 'ko' }}
{{ nested.definedArray.0          is     defined ? 'ok' : 'ko' }}
{{ nested['definedArray'][0]      is     defined ? 'ok' : 'ko' }}
{{ object.foo                     is     defined ? 'ok' : 'ko' }}
{{ object.undefinedMethod         is     defined ? 'ko' : 'ok' }}
{{ object.getFoo()                is     defined ? 'ok' : 'ko' }}
{{ object.getFoo('a')             is     defined ? 'ok' : 'ko' }}
{{ object.undefinedMethod()       is     defined ? 'ko' : 'ok' }}
{{ object.undefinedMethod('a')    is     defined ? 'ko' : 'ok' }}
{{ object.self.foo                is     defined ? 'ok' : 'ko' }}
{{ object.self.undefinedMethod    is     defined ? 'ko' : 'ok' }}
{{ object.undefinedMethod.self    is     defined ? 'ko' : 'ok' }}
{{ 0                              is     defined ? 'ok' : 'ko' }}
{{ "foo"                          is     defined ? 'ok' : 'ko' }}
{{ true                           is     defined ? 'ok' : 'ko' }}
{{ false                          is     defined ? 'ok' : 'ko' }}
{{ null                           is     defined ? 'ok' : 'ko' }}
{{ [1, 2]                         is     defined ? 'ok' : 'ko' }}
{{ { foo: "bar" }                 is     defined ? 'ok' : 'ko' }}
--DATA--
return [
    'definedVar' => 'defined',
    'zeroVar'    => 0,
    'nullVar'    => null,
    'nested'      => [
        'definedVar'   => 'defined',
        'zeroVar'      => 0,
        'nullVar'      => null,
        'definedArray' => [0],
    ],
    'object' => new Twig\Tests\TwigTestFoo(),
]
--EXPECT--
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
--DATA--
return [
    'definedVar' => 'defined',
    'zeroVar'    => 0,
    'nullVar'    => null,
    'nested'      => [
        'definedVar'   => 'defined',
        'zeroVar'      => 0,
        'nullVar'      => null,
        'definedArray' => [0],
    ],
    'object' => new Twig\Tests\TwigTestFoo(),
]
--CONFIG--
return ['strict_variables' => false]
--EXPECT--
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
