Files
phpy/tests/phpunit/TypeTest.php
he426100 84f0b2dd88 fix core dump when "new PyType" (#30)
* fix core dump when "new PyType"

* add test code

---------

Co-authored-by: 弄月 <{ID}+{username}@users.noreply.github.com>
2023-12-26 18:37:06 +08:00

26 lines
550 B
PHP

<?php
use PHPUnit\Framework\TestCase;
class TypeTest extends TestCase
{
function testType()
{
$type = PyCore::type(1);
$this->assertTrue($type instanceof PyType);
$this->assertEquals("<class 'int'>", (string)$type);
}
function testNewType()
{
try {
new PyType;
} catch (Error $error) {
$this->assertStringContainsString('private PyType::__construct()', $error->getMessage());
$success = false;
}
$this->assertFalse($success);
}
}