From f2179c9ccf0d199af1ea2c3320945f20a2f12f6e Mon Sep 17 00:00:00 2001 From: Akaps316 <48785708+Akaps316@users.noreply.github.com> Date: Sat, 11 Apr 2026 21:28:37 +0530 Subject: Address code review feedback by waruqi: refactor parameter parsing, remove local functions, and use simpler test env --- tests/plugins/show/test.lua | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'tests') 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"}) -- cgit v1.3.1