Skip to content

Commit aa15853

Browse files
committed
test: add tests for syncing the versions
1 parent 5cd5225 commit aa15853

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/__tests__/main.test.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { getCompilerInfo } from "../main"
1+
import { syncVersions } from "../default_versions"
2+
import { getCompilerInfo, Inputs, parseArgs } from "../main"
23

34
jest.setTimeout(300000)
45
describe("getCompilerInfo", () => {
@@ -20,3 +21,16 @@ describe("getCompilerInfo", () => {
2021
expect(version).toBe("12")
2122
})
2223
})
24+
25+
describe("syncVersion", () => {
26+
it("Syncs llvm tools versions", async () => {
27+
const llvmTools = ["llvm", "clangtidy", "clangformat"] as Inputs[]
28+
expect(syncVersions(parseArgs(["--llvm", "14.0.0", "--clangtidy", "true"]), llvmTools)).toBe(true)
29+
expect(syncVersions(parseArgs(["--llvm", "13.0.0", "--clangtidy", "true"]), llvmTools)).toBe(true)
30+
expect(syncVersions(parseArgs(["--llvm", "13.0.0", "--clangtidy", "12.0.0"]), llvmTools)).toBe(false)
31+
32+
const opts = parseArgs(["--llvm", "14.0.0", "--clangtidy", "true"])
33+
expect(syncVersions(opts, llvmTools)).toBe(true)
34+
expect(opts.llvm).toBe(opts.clangtidy)
35+
})
36+
})

0 commit comments

Comments
 (0)