From 81f359dbcf8599eb38ab1816f4cc25bb61bf6512 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 29 Jul 2025 10:39:21 +0700 Subject: [PATCH] fix tests --- src/SPC/util/SPCTarget.php | 3 ++- tests/SPC/util/SPCTargetTest.php | 28 +++------------------------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/SPC/util/SPCTarget.php b/src/SPC/util/SPCTarget.php index 583fa757..fac548aa 100644 --- a/src/SPC/util/SPCTarget.php +++ b/src/SPC/util/SPCTarget.php @@ -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 { diff --git a/tests/SPC/util/SPCTargetTest.php b/tests/SPC/util/SPCTargetTest.php index dc003932..f14f0e6c 100644 --- a/tests/SPC/util/SPCTargetTest.php +++ b/tests/SPC/util/SPCTargetTest.php @@ -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');