summaryrefslogtreecommitdiff
path: root/tests/plugins
diff options
context:
space:
mode:
authorAkaps316 <[email protected]>2026-04-11 21:45:14 +0530
committerruki <[email protected]>2026-04-20 09:35:36 +0800
commit0c36a9b4acb9150c607b3d70291ad50148785038 (patch)
treed2fc2fbadbabb7281d585d3d1adfe9b15f066710 /tests/plugins
parentf2179c9ccf0d199af1ea2c3320945f20a2f12f6e (diff)
Refactor to use test project fixture and ordered dependencies
Diffstat (limited to 'tests/plugins')
-rw-r--r--tests/plugins/show/test.lua75
1 files changed, 0 insertions, 75 deletions
diff --git a/tests/plugins/show/test.lua b/tests/plugins/show/test.lua
deleted file mode 100644
index 4bffa5bff..000000000
--- a/tests/plugins/show/test.lua
+++ /dev/null
@@ -1,75 +0,0 @@
-import("core.base.json")
-
-local function _create_project(tempdir)
- io.writefile(path.join(tempdir, "xmake.lua"), [[
-add_rules("mode.debug", "mode.release")
-
-target("core")
- set_kind("static")
- add_files("src/core.c")
-
-target("ui")
- set_kind("static")
- add_deps("core")
- add_files("src/ui.c")
-
-target("app")
- set_kind("binary")
- add_deps("core", "ui")
- add_files("src/main.c")
-]])
- os.mkdir(path.join(tempdir, "src"))
- io.writefile(path.join(tempdir, "src", "core.c"), "int core(void) { return 0; }\n")
- io.writefile(path.join(tempdir, "src", "ui.c"), "int ui(void) { return 0; }\n")
- io.writefile(path.join(tempdir, "src", "main.c"), "int main(void) { return 0; }\n")
-end
-
-function test_target_graph_json(t)
- local tempdir = os.tmpfile()
- os.mkdir(tempdir)
- _create_project(tempdir)
-
- local homedir = path.join(tempdir, "home")
- os.setenv("HOME", homedir)
- os.mkdir(homedir)
- os.mkdir(path.join(homedir, ".xmake"))
-
- local outdata = os.iorunv("xmake", {"show", "-P", tempdir, "--info=depgraph", "--json"})
- local graph = json.decode(outdata)
-
- t:are_equal(graph.root_targets, {"app"})
- t:require(#graph.targets == 3)
-
- local entries = {}
- for _, target in ipairs(graph.targets) do
- entries[target.name] = target
- end
- t:are_equal(entries.core.deps, {})
- t:are_equal(entries.ui.deps, {"core"})
- t:are_equal(entries.app.deps, {"core", "ui"})
- t:are_equal(entries.app.orderdeps, {"core", "ui"})
- t:are_equal(entries.app.kind, "binary")
-end
-
-function test_target_graph_json_for_single_target(t)
- local tempdir = os.tmpfile()
- os.mkdir(tempdir)
- _create_project(tempdir)
-
- local homedir = path.join(tempdir, "home")
- os.setenv("HOME", homedir)
- os.mkdir(homedir)
- os.mkdir(path.join(homedir, ".xmake"))
-
- local outdata = os.iorunv("xmake", {"show", "-P", tempdir, "--info=depgraph", "--target=app", "--json"})
- local graph = json.decode(outdata)
-
- t:are_equal(graph.root_targets, {"app"})
- t:require(#graph.targets == 3)
-
- local names = {}
- for _, target in ipairs(graph.targets) do
- table.insert(names, target.name)
- end
- t:are_equal(names, {"core", "ui", "app"})
-end