mirror of https://github.com/aminya/setup-cpp
23 lines
653 B
TypeScript
23 lines
653 B
TypeScript
|
import { getCompilerInfo } from "../main"
|
||
|
|
||
|
jest.setTimeout(300000)
|
||
|
describe("getCompilerInfo", () => {
|
||
|
it("version will be undefined if not provided", () => {
|
||
|
const { compiler, version } = getCompilerInfo("llvm")
|
||
|
expect(compiler).toBe("llvm")
|
||
|
expect(version).toBeUndefined()
|
||
|
})
|
||
|
|
||
|
it("extracts version", () => {
|
||
|
const { compiler, version } = getCompilerInfo("llvm-12.0.0")
|
||
|
expect(compiler).toBe("llvm")
|
||
|
expect(version).toBe("12.0.0")
|
||
|
})
|
||
|
|
||
|
it("finds a version even if not semver", () => {
|
||
|
const { compiler, version } = getCompilerInfo("llvm-12")
|
||
|
expect(compiler).toBe("llvm")
|
||
|
expect(version).toBe("12")
|
||
|
})
|
||
|
})
|