fix tests

This commit is contained in:
DubbleClick 2025-07-29 10:39:21 +07:00
parent 72abd63b69
commit 81f359dbcf
2 changed files with 5 additions and 26 deletions

View File

@ -17,6 +17,8 @@ use SPC\toolchain\ToolchainManager;
*/
class SPCTarget
{
const array LIBC_LIST = ['musl', 'glibc'];
/**
* Returns whether we link the C runtime in statically.
*/
@ -107,7 +109,6 @@ class SPCTarget
* Currently, we only support native building.
*
* @return 'BSD'|'Darwin'|'Linux'|'Windows'
* @throws WrongUsageException
*/
public static function getTargetOS(): string
{

View File

@ -85,19 +85,6 @@ final class SPCTargetTest extends TestBase
$this->assertEquals($expected, $result);
}
/**
* @dataProvider invalidTargetProvider
*/
public function testGetTargetOSWithInvalidTarget(string $target): void
{
putenv("SPC_TARGET={$target}");
$this->expectException(WrongUsageException::class);
$this->expectExceptionMessage('Cannot parse target.');
SPCTarget::getTargetOS();
}
public function testLibcListConstant(): void
{
$this->assertIsArray(SPCTarget::LIBC_LIST);
@ -117,22 +104,13 @@ final class SPCTargetTest extends TestBase
public function targetOSProvider(): array
{
return [
'linux-target' => ['linux-x86_64', 'Linux'],
'macos-target' => ['macos-x86_64', 'Darwin'],
'windows-target' => ['windows-x86_64', 'Windows'],
'linux-target' => ['native-linux', 'Linux'],
'macos-target' => ['native-macos', 'Darwin'],
'windows-target' => ['native-windows', 'Windows'],
'empty-target' => ['', PHP_OS_FAMILY],
];
}
public function invalidTargetProvider(): array
{
return [
'invalid-target' => ['invalid-target'],
'unknown-target' => ['unknown-target'],
'mixed-target' => ['mixed-target'],
];
}
private function assertIsStringOrNull($value): void
{
$this->assertTrue(is_string($value) || is_null($value), 'Value must be string or null');