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

View File

@ -85,19 +85,6 @@ final class SPCTargetTest extends TestBase
$this->assertEquals($expected, $result); $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 public function testLibcListConstant(): void
{ {
$this->assertIsArray(SPCTarget::LIBC_LIST); $this->assertIsArray(SPCTarget::LIBC_LIST);
@ -117,22 +104,13 @@ final class SPCTargetTest extends TestBase
public function targetOSProvider(): array public function targetOSProvider(): array
{ {
return [ return [
'linux-target' => ['linux-x86_64', 'Linux'], 'linux-target' => ['native-linux', 'Linux'],
'macos-target' => ['macos-x86_64', 'Darwin'], 'macos-target' => ['native-macos', 'Darwin'],
'windows-target' => ['windows-x86_64', 'Windows'], 'windows-target' => ['native-windows', 'Windows'],
'empty-target' => ['', PHP_OS_FAMILY], '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 private function assertIsStringOrNull($value): void
{ {
$this->assertTrue(is_string($value) || is_null($value), 'Value must be string or null'); $this->assertTrue(is_string($value) || is_null($value), 'Value must be string or null');