summaryrefslogtreecommitdiff
path: root/tests/projects/c++/modules/add_move_remove_module/test.lua
blob: dbaeedbb2409710467935dbcee98f11a093d03a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
inherit(".test_base")
import("utils.ci.is_running", {alias = "ci_is_running"})

function _build(_)
    local flags = ""
    if ci_is_running() then
        flags = "-vD"
    end
    os.run("xmake -r " .. flags)
    io.writefile("src/bar.mpp", "export module bar;\n export {\n inline int bar() { return 0; }\n}")
    os.run("xmake " .. flags)
    os.rm("src/bar.mpp")
    os.run("xmake " .. flags)
    os.mv("src/foo.mpp", "src/bar.mpp")
    os.run("xmake " .. flags)
    os.mv("src/bar.mpp", "src/foo.mpp")
end

function main(_)
    local clang_options = {compiler = "clang", version = clang_min_ver(), build = _build}
    local gcc_options = {compiler = "gcc", version = gcc_min_ver(), build = _build}
    local msvc_options = {version = msvc_min_ver(), build = _build}
    run_tests(clang_options, gcc_options, msvc_options)
end