Skip to content

Commit 81f359d

Browse files
committed
fix tests
1 parent 72abd63 commit 81f359d

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

src/SPC/util/SPCTarget.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818
class SPCTarget
1919
{
20+
const array LIBC_LIST = ['musl', 'glibc'];
21+
2022
/**
2123
* Returns whether we link the C runtime in statically.
2224
*/
@@ -107,7 +109,6 @@ public static function getLibcVersion(): ?string
107109
* Currently, we only support native building.
108110
*
109111
* @return 'BSD'|'Darwin'|'Linux'|'Windows'
110-
* @throws WrongUsageException
111112
*/
112113
public static function getTargetOS(): string
113114
{

tests/SPC/util/SPCTargetTest.php

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,6 @@ public function testGetTargetOS(string $target, string $expected): void
8585
$this->assertEquals($expected, $result);
8686
}
8787

88-
/**
89-
* @dataProvider invalidTargetProvider
90-
*/
91-
public function testGetTargetOSWithInvalidTarget(string $target): void
92-
{
93-
putenv("SPC_TARGET={$target}");
94-
95-
$this->expectException(WrongUsageException::class);
96-
$this->expectExceptionMessage('Cannot parse target.');
97-
98-
SPCTarget::getTargetOS();
99-
}
100-
10188
public function testLibcListConstant(): void
10289
{
10390
$this->assertIsArray(SPCTarget::LIBC_LIST);
@@ -117,22 +104,13 @@ public function libcProvider(): array
117104
public function targetOSProvider(): array
118105
{
119106
return [
120-
'linux-target' => ['linux-x86_64', 'Linux'],
121-
'macos-target' => ['macos-x86_64', 'Darwin'],
122-
'windows-target' => ['windows-x86_64', 'Windows'],
107+
'linux-target' => ['native-linux', 'Linux'],
108+
'macos-target' => ['native-macos', 'Darwin'],
109+
'windows-target' => ['native-windows', 'Windows'],
123110
'empty-target' => ['', PHP_OS_FAMILY],
124111
];
125112
}
126113

127-
public function invalidTargetProvider(): array
128-
{
129-
return [
130-
'invalid-target' => ['invalid-target'],
131-
'unknown-target' => ['unknown-target'],
132-
'mixed-target' => ['mixed-target'],
133-
];
134-
}
135-
136114
private function assertIsStringOrNull($value): void
137115
{
138116
$this->assertTrue(is_string($value) || is_null($value), 'Value must be string or null');

0 commit comments

Comments
 (0)