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.
 
 

24 lines
817 B

<?php
use TypePhp\CompilerTest;
final class UnaryPlusCodegenTest extends \BaseTest
{
public function testNativeNumericUnaryPlusDoesNotBoxItsOperand(): void
{
global $translator;
$compiler = CompilerTest::create(TYPEPHP_ROOT_PATH);
$translator = $compiler;
$source = TYPEPHP_ROOT_PATH . '/phpunit/code/unary-plus-codegen.php';
$compiler->addFiles([$source]);
$compiler->prepareFile($source);
$generated = $compiler->convertFile($source);
$code = file_get_contents($generated);
self::assertIsString($code);
self::assertStringNotContainsString('php::Variant(number)', $code);
self::assertStringContainsString('php::toInt(number)', $code);
self::assertStringContainsString('php::toFloat(number)', $code);
}
}