Extend BaseParsing test coverage

Change-Id: I4e8ff663e1516bcdeb6133bb12391ad48b056367
This commit is contained in:
Moritz Schubotz (physikerwelt) 2024-05-26 22:37:07 +02:00
parent 1befc6373d
commit c0ac8ee0e7
No known key found for this signature in database
GPG key ID: F803DB146DDF36C3

View file

@ -6,6 +6,8 @@ use MediaWiki\Extension\Math\WikiTexVC\MMLmappings\BaseParsing;
use MediaWiki\Extension\Math\WikiTexVC\Nodes\DQ;
use MediaWiki\Extension\Math\WikiTexVC\Nodes\Fun1;
use MediaWiki\Extension\Math\WikiTexVC\Nodes\Literal;
use MediaWiki\Extension\Math\WikiTexVC\Nodes\Matrix;
use MediaWiki\Extension\Math\WikiTexVC\Nodes\TexArray;
use PHPUnit\Framework\TestCase;
/**
@ -32,6 +34,33 @@ class BaseParsingTest extends TestCase {
$this->assertStringContainsString( '<mi k="v"', $result );
}
public function testArray() {
$node = new Matrix( 'matrix',
new TexArray( new TexArray( new Literal( 'a' ) ) ) );
$result = BaseParsing::array( $node, [], null, 'array', '007E' );
$this->assertStringContainsString( '<mi>a</mi>', $result );
}
public function testBoldSymbol() {
$node = new Fun1(
'\\boldsymbol',
( new Literal( 'a' ) )
);
$result = BaseParsing::boldsymbol( $node, [], null, 'boldsymbol' );
$this->assertStringContainsString( 'mathvariant="bold-italic"', $result );
}
public function testCancel() {
$node = new Fun1(
'\\cancel',
( new Literal( 'a' ) )
);
$result = BaseParsing::cancel( $node, [], null, 'cancel', 'something' );
$this->assertStringContainsString( '<menclose notation="something"><mi>a</mi></menclose>',
$result );
}
public function testUnderOver() {
$node = new Fun1(
'\\overline',