diff options
| author | Akaps316 <[email protected]> | 2026-04-11 21:28:37 +0530 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-04-20 09:35:36 +0800 |
| commit | f2179c9ccf0d199af1ea2c3320945f20a2f12f6e (patch) | |
| tree | c173df0a373be2a713eed0802151af8404baff0a /tests/plugins | |
| parent | 8512dce671af24d2f293728bfdb9e65f81e5ed38 (diff) | |
Address code review feedback by waruqi: refactor parameter parsing, remove local functions, and use simpler test env
Diffstat (limited to 'tests/plugins')
| -rw-r--r-- | tests/plugins/show/test.lua | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/tests/plugins/show/test.lua b/tests/plugins/show/test.lua index 0c0f783e6..4bffa5bff 100644 --- a/tests/plugins/show/test.lua +++ b/tests/plugins/show/test.lua @@ -1,13 +1,5 @@ import("core.base.json") -local function _prepare_xmake_env() - local xmake = path.absolute(os.programfile()) - local xmake_program_dir = path.absolute(os.programdir()) - os.setenv("XMAKE_PROGRAM_FILE", xmake) - os.setenv("XMAKE_PROGRAM_DIR", xmake_program_dir) - return xmake -end - local function _create_project(tempdir) io.writefile(path.join(tempdir, "xmake.lua"), [[ add_rules("mode.debug", "mode.release") @@ -42,8 +34,7 @@ function test_target_graph_json(t) os.mkdir(homedir) os.mkdir(path.join(homedir, ".xmake")) - local xmake = _prepare_xmake_env() - local outdata = os.iorunv(xmake, {"show", "-P", tempdir, "--target_graph", "--json"}) + local outdata = os.iorunv("xmake", {"show", "-P", tempdir, "--info=depgraph", "--json"}) local graph = json.decode(outdata) t:are_equal(graph.root_targets, {"app"}) @@ -70,8 +61,7 @@ function test_target_graph_json_for_single_target(t) os.mkdir(homedir) os.mkdir(path.join(homedir, ".xmake")) - local xmake = _prepare_xmake_env() - local outdata = os.iorunv(xmake, {"show", "-P", tempdir, "--target_graph", "--target=app", "--json"}) + 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"}) |
