TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.3 KiB
33 lines
1.3 KiB
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use TypePhp\CompilerTest;
|
|
|
|
final class WrapperArgumentMoveTest extends TestCase
|
|
{
|
|
public function testWrapperConsumesOnlyDeadByValueWrappers(): void
|
|
{
|
|
global $translator;
|
|
$compiler = CompilerTest::create(ROOT_PATH);
|
|
$translator = $compiler;
|
|
$file = __DIR__ . '/../code/wrapper-argument-move.php';
|
|
$compiler->addFiles([$file]);
|
|
$compiler->prepareFile($file);
|
|
$cppFile = $compiler->convertFile($file);
|
|
$code = file_get_contents($cppFile);
|
|
|
|
$this->assertStringContainsString(
|
|
'php_phpunit_wrapper_argument_move(php::takeValue(arg_value),php::takeValue(arg_text),'
|
|
. 'php::takeValue(arg_items),php::takeValue(arg_object),arg_count,arg_reference,'
|
|
. 'php::takeValue(arg_rest));',
|
|
$code,
|
|
);
|
|
$this->assertStringNotContainsString('php::takeValue(arg_count)', $code);
|
|
$this->assertStringNotContainsString('php::takeValue(arg_reference)', $code);
|
|
$this->assertStringContainsString(
|
|
'php_phpunitwrapperargumentmovetarget__consume(this_, php::takeValue(arg_value));',
|
|
$code,
|
|
);
|
|
$this->assertStringNotContainsString('php::takeValue(this_)', $code);
|
|
}
|
|
}
|
|
|