Skip to content

Commit 7c6d1e8

Browse files
committed
Fix getTargetArchitecture tests
1 parent f5dc78e commit 7c6d1e8

File tree

1 file changed

+32
-17
lines changed

1 file changed

+32
-17
lines changed

test/unitTests/coreclr-debug/targetArchitecture.test.ts

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,74 +14,89 @@ suite("getTargetArchitecture Tests", () => {
1414

1515
suite("Windows", () => {
1616
test("Windows x86_64", () => {
17-
const platformInfo: PlatformInformation = new PlatformInformation("win32", "x86_64", null);
17+
const platformInfo = new PlatformInformation("win32", "x86_64");
18+
const dotnetInfo: DotnetInfo = {
19+
FullInfo: "Irrelevant",
20+
Version: "5.0.0",
21+
RuntimeId: "win10-x64",
22+
};
1823

19-
const targetArchitecture = getTargetArchitecture(platformInfo, null, null);
24+
const targetArchitecture = getTargetArchitecture(platformInfo, undefined, dotnetInfo);
2025

2126
assert.equal(targetArchitecture, "");
2227
});
2328
});
2429

2530
suite("Linux", () => {
2631
test("getTargetArchitecture on Linux", () => {
27-
const platformInfo: PlatformInformation = new PlatformInformation("linux", "x86_64", null);
32+
const platformInfo = new PlatformInformation("linux", "x86_64");
33+
const dotnetInfo: DotnetInfo = {
34+
FullInfo: "Irrelevant",
35+
Version: "5.0.0",
36+
RuntimeId: "linux-x64",
37+
};
2838

29-
const targetArchitecture = getTargetArchitecture(platformInfo, null, null);
39+
const targetArchitecture = getTargetArchitecture(platformInfo, undefined, dotnetInfo);
3040

3141
assert.equal(targetArchitecture, "");
3242
});
3343
});
3444

3545
suite("macOS", () => {
3646
test("Apple x86_64", () => {
37-
const platformInfo: PlatformInformation = new PlatformInformation("darwin", "x86_64", null);
47+
const platformInfo = new PlatformInformation("darwin", "x86_64");
48+
const dotnetInfo: DotnetInfo = {
49+
FullInfo: "Irrelevant",
50+
Version: "5.0.0",
51+
RuntimeId: "osx.11.0-x64",
52+
};
3853

39-
const targetArchitecture = getTargetArchitecture(platformInfo, null, null);
54+
const targetArchitecture = getTargetArchitecture(platformInfo, undefined, dotnetInfo);
4055

4156
assert.equal(targetArchitecture, "x86_64");
4257
});
4358

4459
test("Apple ARM64 on .NET 5", () => {
45-
const platformInfo: PlatformInformation = new PlatformInformation("darwin", "arm64", null);
60+
const platformInfo = new PlatformInformation("darwin", "arm64");
4661
const dotnetInfo: DotnetInfo = {
4762
FullInfo: "Irrelevant",
4863
Version: "5.0.0",
4964
RuntimeId: "osx.11.0-x64",
5065
};
5166

52-
const targetArchitecture = getTargetArchitecture(platformInfo, null, dotnetInfo);
67+
const targetArchitecture = getTargetArchitecture(platformInfo, undefined, dotnetInfo);
5368

5469
assert.equal(targetArchitecture, "x86_64");
5570
});
5671

5772
test("Apple ARM64 on .NET 6 osx-arm64", () => {
58-
const platformInfo: PlatformInformation = new PlatformInformation("darwin", "arm64", null);
73+
const platformInfo = new PlatformInformation("darwin", "arm64");
5974
const dotnetInfo: DotnetInfo = {
6075
FullInfo: "Irrelevant",
6176
Version: "6.0.0",
6277
RuntimeId: "osx.11.0-arm64",
6378
};
6479

65-
const targetArchitecture = getTargetArchitecture(platformInfo, null, dotnetInfo);
80+
const targetArchitecture = getTargetArchitecture(platformInfo, undefined, dotnetInfo);
6681

6782
assert.equal(targetArchitecture, "arm64");
6883
});
6984

7085
test("Apple ARM64 on .NET 6 osx-x64", () => {
71-
const platformInfo: PlatformInformation = new PlatformInformation("darwin", "arm64", null);
86+
const platformInfo = new PlatformInformation("darwin", "arm64");
7287
const dotnetInfo: DotnetInfo = {
7388
FullInfo: "Irrelevant",
7489
Version: "6.0.0",
7590
RuntimeId: "osx.11.0-x64",
7691
};
7792

78-
const targetArchitecture = getTargetArchitecture(platformInfo, null, dotnetInfo);
93+
const targetArchitecture = getTargetArchitecture(platformInfo, undefined, dotnetInfo);
7994

8095
assert.equal(targetArchitecture, "x86_64");
8196
});
8297

8398
test("Apple ARM64 on .NET 6 osx-arm64 with targetArchitecture: 'arm64'", () => {
84-
const platformInfo: PlatformInformation = new PlatformInformation("darwin", "arm64", null);
99+
const platformInfo = new PlatformInformation("darwin", "arm64");
85100
const dotnetInfo: DotnetInfo = {
86101
FullInfo: "Irrelevant",
87102
Version: "6.0.0",
@@ -94,7 +109,7 @@ suite("getTargetArchitecture Tests", () => {
94109
});
95110

96111
test("Apple ARM64 on .NET 6 osx-arm64 with targetArchitecture: 'x86_64'", () => {
97-
const platformInfo: PlatformInformation = new PlatformInformation("darwin", "arm64", null);
112+
const platformInfo = new PlatformInformation("darwin", "arm64");
98113
const dotnetInfo: DotnetInfo = {
99114
FullInfo: "Irrelevant",
100115
Version: "6.0.0",
@@ -107,7 +122,7 @@ suite("getTargetArchitecture Tests", () => {
107122
});
108123

109124
test("Apple ARM64 on .NET 6 osx-arm64 with invalid targetArchitecture", () => {
110-
const platformInfo: PlatformInformation = new PlatformInformation("darwin", "arm64", null);
125+
const platformInfo = new PlatformInformation("darwin", "arm64");
111126
const dotnetInfo: DotnetInfo = {
112127
FullInfo: "Irrelevant",
113128
Version: "6.0.0",
@@ -120,14 +135,14 @@ suite("getTargetArchitecture Tests", () => {
120135
});
121136

122137
test("Apple ARM64 on .NET 6 osx-arm64 with invalid RuntimeId", () => {
123-
const platformInfo: PlatformInformation = new PlatformInformation("darwin", "arm64", null);
138+
const platformInfo = new PlatformInformation("darwin", "arm64");
124139
const dotnetInfo: DotnetInfo = {
125140
FullInfo: "Irrelevant",
126141
Version: "6.0.0",
127142
RuntimeId: "osx.11.0-FUTURE_ISA",
128143
};
129144

130-
let fn = function () { getTargetArchitecture(platformInfo, null, dotnetInfo); };
145+
let fn = function () { getTargetArchitecture(platformInfo, undefined, dotnetInfo); };
131146

132147
expect(fn).to.throw(`Unexpected RuntimeId 'osx.11.0-FUTURE_ISA'.`);
133148
});

0 commit comments

Comments
 (0)