mirror of https://github.com/aminya/setup-cpp
test: add tests for syncing the versions
This commit is contained in:
parent
5cd5225bee
commit
aa158537ff
|
@ -1,4 +1,5 @@
|
|||
import { getCompilerInfo } from "../main"
|
||||
import { syncVersions } from "../default_versions"
|
||||
import { getCompilerInfo, Inputs, parseArgs } from "../main"
|
||||
|
||||
jest.setTimeout(300000)
|
||||
describe("getCompilerInfo", () => {
|
||||
|
@ -20,3 +21,16 @@ describe("getCompilerInfo", () => {
|
|||
expect(version).toBe("12")
|
||||
})
|
||||
})
|
||||
|
||||
describe("syncVersion", () => {
|
||||
it("Syncs llvm tools versions", async () => {
|
||||
const llvmTools = ["llvm", "clangtidy", "clangformat"] as Inputs[]
|
||||
expect(syncVersions(parseArgs(["--llvm", "14.0.0", "--clangtidy", "true"]), llvmTools)).toBe(true)
|
||||
expect(syncVersions(parseArgs(["--llvm", "13.0.0", "--clangtidy", "true"]), llvmTools)).toBe(true)
|
||||
expect(syncVersions(parseArgs(["--llvm", "13.0.0", "--clangtidy", "12.0.0"]), llvmTools)).toBe(false)
|
||||
|
||||
const opts = parseArgs(["--llvm", "14.0.0", "--clangtidy", "true"])
|
||||
expect(syncVersions(opts, llvmTools)).toBe(true)
|
||||
expect(opts.llvm).toBe(opts.clangtidy)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue