mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-12-11 15:36:28 +00:00
6be5724740
Texutil related functionalities and tests will come in other changeset.
Related code:
fb56991251/lib/nodes/
Bug: T312528
Change-Id: Iead338a31403348603442b43ae802270f6b1d675
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\Math\Tests\TexVC\Nodes;
|
|
|
|
use ArgumentCountError;
|
|
use MediaWiki\Extension\Math\TexVC\Nodes\FQ;
|
|
use MediaWiki\Extension\Math\TexVC\Nodes\Literal;
|
|
use MediaWikiUnitTestCase;
|
|
use TypeError;
|
|
|
|
/**
|
|
* @covers \MediaWiki\Extension\Math\TexVC\Nodes\FQ
|
|
*/
|
|
class FQTest extends MediaWikiUnitTestCase {
|
|
|
|
public function testEmptyFQ() {
|
|
$this->expectException( ArgumentCountError::class );
|
|
new FQ();
|
|
throw new ArgumentCountError( 'Should not create an empty fq' );
|
|
}
|
|
|
|
public function testOneArgumentFQ() {
|
|
$this->expectException( ArgumentCountError::class );
|
|
new FQ( new Literal( 'a' ) );
|
|
throw new ArgumentCountError( 'Should not create a fq with one argument' );
|
|
}
|
|
|
|
public function testIncorrectTypeFQ() {
|
|
$this->expectException( TypeError::class );
|
|
new FQ( 'a', 'b', 'c' );
|
|
throw new TypeError( 'Should not create a fq with incorrect type' );
|
|
}
|
|
|
|
public function testBasicFQ() {
|
|
$fq = new FQ( new Literal( 'a' ), new Literal( 'b' ), new Literal( 'c' ) );
|
|
$this->assertEquals( 'a_{b}^{c}', $fq->render(), 'Should create a basic fq' );
|
|
}
|
|
|
|
}
|