<commit_before><?php

/*
 * This file is part of Twig.
 *
 * (c) <NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
class Twig_Tests_ParserTest extends PHPUnit_Framework_TestCase
{
    /**
     * @expectedException Twig_Error_Syntax
     */
    public function testSetMacroThrowsExceptionOnReservedMethods()
    {
        $parser = new Twig_Parser(new Twig_Environment());
        $parser->setMacro('display', $this->getMock('Twig_Node_Macro', null, array(), '', null));
    }

    /**
     * @dataProvider getFilterBodyNodesData
     */
    public function testFilterBodyNodes($input, $expected)
    {
        list($parser, $invoker) = $this->getParserForFilterBodyNodes();

        $this->assertEquals($expected, $invoker->invoke($parser, $input));
    }

    public function getFilterBodyNodesData()
    {
        return array(
            array(
                new Twig_Node(array(new Twig_Node_Text('   ', 0))),
                new Twig_Node(array()),
            ),
            array(
                $input = new Twig_Node(array(new Twig_Node_Set(false, new Twig_Node(), new Twig_Node(), 0))),
                $input,
            ),
        );
    }

    /**
     * @dataProvider getFilterBodyNodesDataThrowsException
     * @expectedException Twig_Error_Syntax
     */
    public function testFilterBodyNodesThrowsException($input)
    {
        list($parser, $invoker) = $this->getParserForFilterBodyNodes();

        $invoker->invoke($parser, $input);
    }

    public function getFilterBodyNodesDataThrowsException()
    {
        return array(
            array(new Twig_Node_Text('foo', 0)),
            array(new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 0)))))),
        );
    }

    protected function getParserForFilterBodyNodes()
    {
        $invoker = new ReflectionMethod('Twig_Parser', 'filterBodyNodes');
        $invoker->setAccessible(true);

        $p = new ReflectionProperty('Twig_Parser', 'stream');
        $p->setAccessible(true);

        $parser = new Twig_Parser(new Twig_Environment());
        $parser->setParent(new Twig_Node());
        $p->setValue($parser, $this->getMockBuilder('Twig_TokenStream')->disableOriginalConstructor()->getMock());

        return array($parser, $invoker);
    }
}
//Twig_Error_Syntax
<commit_msg>removed comment<commit_after><?php

/*
 * This file is part of Twig.
 *
 * (c) <NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
class Twig_Tests_ParserTest extends PHPUnit_Framework_TestCase
{
    /**
     * @expectedException Twig_Error_Syntax
     */
    public function testSetMacroThrowsExceptionOnReservedMethods()
    {
        $parser = new Twig_Parser(new Twig_Environment());
        $parser->setMacro('display', $this->getMock('Twig_Node_Macro', null, array(), '', null));
    }

    /**
     * @dataProvider getFilterBodyNodesData
     */
    public function testFilterBodyNodes($input, $expected)
    {
        list($parser, $invoker) = $this->getParserForFilterBodyNodes();

        $this->assertEquals($expected, $invoker->invoke($parser, $input));
    }

    public function getFilterBodyNodesData()
    {
        return array(
            array(
                new Twig_Node(array(new Twig_Node_Text('   ', 0))),
                new Twig_Node(array()),
            ),
            array(
                $input = new Twig_Node(array(new Twig_Node_Set(false, new Twig_Node(), new Twig_Node(), 0))),
                $input,
            ),
        );
    }

    /**
     * @dataProvider getFilterBodyNodesDataThrowsException
     * @expectedException Twig_Error_Syntax
     */
    public function testFilterBodyNodesThrowsException($input)
    {
        list($parser, $invoker) = $this->getParserForFilterBodyNodes();

        $invoker->invoke($parser, $input);
    }

    public function getFilterBodyNodesDataThrowsException()
    {
        return array(
            array(new Twig_Node_Text('foo', 0)),
            array(new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 0)))))),
        );
    }

    protected function getParserForFilterBodyNodes()
    {
        $invoker = new ReflectionMethod('Twig_Parser', 'filterBodyNodes');
        $invoker->setAccessible(true);

        $p = new ReflectionProperty('Twig_Parser', 'stream');
        $p->setAccessible(true);

        $parser = new Twig_Parser(new Twig_Environment());
        $parser->setParent(new Twig_Node());
        $p->setValue($parser, $this->getMockBuilder('Twig_TokenStream')->disableOriginalConstructor()->getMock());

        return array($parser, $invoker);
    }
}

{'fraction_non_alphanumeric': 0.1270042194092827, 'fraction_numerical': 0.0016877637130801688, 'mean_word_length': 2.8203062046736505, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3285923', 'n_tokens_mistral': 1398, 'n_tokens_neox': 1364, 'n_words': 262}