Skip to content

Commit

Permalink
Restrict supported releases (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbuzinski authored May 9, 2023
1 parent 180c8e5 commit a01189a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import * as path from "path";
*/
export async function install(platform: string, architecture: string, release: string, products: string[]) {
const releaseInfo = await matlab.getReleaseInfo(release);
if (releaseInfo.name < "r2020b") {
return Promise.reject(Error(`Release '${releaseInfo.name}' is not supported. Use 'R2020b' or a later release.`));
}

// Install runtime system dependencies for MATLAB on Linux
if (platform === "linux") {
Expand Down
9 changes: 9 additions & 0 deletions src/install.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ describe("install procedure", () => {
expect(setOutputMock).toHaveBeenCalledTimes(1);
});

it("rejects for unsupported MATLAB release", async () => {
matlabGetReleaseInfoMock.mockResolvedValue({
name: "r2020a",
version: "9.8.0",
updateNumber: "latest"
});
await expect(install.install(platform, arch, "r2020a", products)).rejects.toBeDefined();
});

it("rejects for invalid MATLAB version", async () => {
matlabGetReleaseInfoMock.mockRejectedValue(Error("oof"));
await expect(doInstall()).rejects.toBeDefined();
Expand Down

0 comments on commit a01189a

Please sign in to comment.