mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-12-23 04:42:48 +00:00
4b30c9701a
* make intent annotations possible in TeX math items * introduce a new command to annotate as well as node and translation * Adds a parser expression grammar to validate intent attributes for * it basically adds the previous, now abandoned changeset: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Math/+/949964 Bug: T327098 Change-Id: I21adfac4c3580e238f059721fdf0c1566cb4e857
30 lines
902 B
PHP
30 lines
902 B
PHP
<?php
|
|
namespace MediaWiki\Extension\Math\WikiTexVC\Intent;
|
|
|
|
use MediaWiki\Extension\Math\WikiTexVC\TexVC;
|
|
use MediaWikiUnitTestCase;
|
|
|
|
/**
|
|
* Test for intent validation functions and checking basic usage of the experimental
|
|
* intent annotation feature.
|
|
*
|
|
* @covers \MediaWiki\Extension\Math\WikiTexVC\TexVC
|
|
*/
|
|
final class IntentEvalTest extends MediaWikiUnitTestCase {
|
|
public function testTwoArgumentApplication() {
|
|
$input = "first-derivative(\$a)(\$b)";
|
|
$texvc = new TexVC();
|
|
$ret = $texvc->checkIntent( $input );
|
|
$this->assertTrue( $ret );
|
|
}
|
|
|
|
public function testIntentShouldFailIfNotActive() {
|
|
$texVC = new TexVC();
|
|
$resultT = $texVC->check( "\\intent{\\binom{n}{k}}{intent='binomial(\$n,\$k)'}", [
|
|
"useintent" => false,
|
|
] );
|
|
$this->assertEquals( "C", $resultT["status"] );
|
|
$this->assertStringContainsString( "virtual intent package required", $resultT["details"] );
|
|
}
|
|
}
|