<commit_before><?php

/*
* This file is part of Spoon Library.
*
* (c) <NAME> <<EMAIL>>
*
* For the full copyright and license information, please view the license
* file that was distributed with this source code.
*/

namespace Spoon\Template\Tests;
use Spoon\Template\Autoloader;
use Spoon\Template\Environment;
use Spoon\Template\Lexer;
use Spoon\Template\TokenStream;
use Spoon\Template\Token;

require_once realpath(dirname(__FILE__) . '/../') . '/Autoloader.php';
require_once 'PHPUnit/Framework/TestCase.php';

class TokenStreamTest extends \PHPUnit_Framework_TestCase
{
	/**
	 * @var Spoon\Template\TokenStream
	 */
	protected $stream;

	public function setUp()
	{
		Autoloader::register();

		$template = 'Name: {$name}' . "\n";
		$template .= 'E-mail: {$email|lowercase}' . "\n\n";
		$template .= '{if $name == $email}chill mate{endif}' . "\n";

		$lexer = new Lexer(new Environment());
		$this->stream = $lexer->tokenize($template, 'imaginary-template.tpl');
	}

	public function tearDown()
	{
		$this->stream = null;
	}

	public function testExpect()
	{
		// expecting TEXT type with 'Name: ' as value
		$this->stream->expect(Token::TEXT, 'Name: ');
		$this->stream->next();

		// expecting VAR_START
		$this->stream->expect(Token::VAR_START);
		$this->stream->next();

		// expecting NAME with value '$name'
		$this->stream->expect(Token::NAME, 'name');
	}

	/**
	 * @expectedException Spoon\Template\SyntaxError
	 */
	public function testFailExpect()
	{
		$this->stream->expect(Token::OPERATOR, '--');
	}

	public function testGetCurrent()
	{
		$token = new Token(Token::TEXT, 'Name: ', 1);
		$this->assertEquals($token, $this->stream->getCurrent());

		$token = $this->stream->next();
		$this->assertEquals($token, $this->stream->getCurrent());
	}

	public function testGetFilename()
	{
		$this->assertEquals('imaginary-template.tpl', $this->stream->getFilename());
	}

	public function testIsEof()
	{
		$this->assertFalse($this->stream->isEof());
<commit_msg>Makes sure the testExpect method is not marked as skipped.<commit_after><?php

/*
* This file is part of Spoon Library.
*
* (c) <NAME> <<EMAIL>>
*
* For the full copyright and license information, please view the license
* file that was distributed with this source code.
*/

namespace Spoon\Template\Tests;
use Spoon\Template\Autoloader;
use Spoon\Template\Environment;
use Spoon\Template\Lexer;
use Spoon\Template\TokenStream;
use Spoon\Template\Token;

require_once realpath(dirname(__FILE__) . '/../') . '/Autoloader.php';
require_once 'PHPUnit/Framework/TestCase.php';

class TokenStreamTest extends \PHPUnit_Framework_TestCase
{
	/**
	 * @var Spoon\Template\TokenStream
	 */
	protected $stream;

	public function setUp()
	{
		Autoloader::register();

		$template = 'Name: {$name}' . "\n";
		$template .= 'E-mail: {$email|lowercase}' . "\n\n";
		$template .= '{if $name == $email}chill mate{endif}' . "\n";

		$lexer = new Lexer(new Environment());
		$this->stream = $lexer->tokenize($template, 'imaginary-template.tpl');
	}

	public function tearDown()
	{
		$this->stream = null;
	}

	public function testExpect()
	{
		// expecting TEXT type with 'Name: ' as value
		$this->stream->expect(Token::TEXT, 'Name: ');
		$this->stream->next();

		// expecting VAR_START
		$this->stream->expect(Token::VAR_START);
		$this->stream->next();

		// expecting NAME with value '$name'
		$this->stream->expect(Token::NAME, 'name');
		$this->assertTrue(true);
	}

	/**
	 * @expectedException Spoon\Template\SyntaxError
	 */
	public function testFailExpect()
	{
		$this->stream->expect(Token::OPERATOR, '--');
	}

	public function testGetCurrent()
	{
		$token = new Token(Token::TEXT, 'Name: ', 1);
		$this->assertEquals($token, $this->stream->getCurrent());

		$token = $this->stream->next();
		$this->assertEquals($token, $this->stream->getCurrent());
	}

	public function testGetFilename()
	{
		$this->assertEquals('imaginary-template.tpl', $this->stream->getFilename());
	}

	public function testIsEof()
	{
		$this->assertFalse($this->stream->isEof());

{'fraction_non_alphanumeric': 0.18075584286424665, 'fraction_numerical': 0.0004972650422675286, 'mean_word_length': 4.385542168674699, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 68, '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': '7025501', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1316, 'n_words': 286}