diff options
| author | Meha555 <[email protected]> | 2026-06-05 22:39:37 +0800 |
|---|---|---|
| committer | Meha555 <[email protected]> | 2026-06-05 22:59:54 +0800 |
| commit | 70c73fe03cde67fd85e082cbdd2be3a406181b1b (patch) | |
| tree | 2c77ced41d326b66dac5b72e4594c5844db16af8 /tests/plugins/show | |
| parent | 2245e0b6ed0f954aae1dafe225c2b436ae98cfcd (diff) | |
Enable `xmake show --format=json`
Fix: #7585
Diffstat (limited to 'tests/plugins/show')
| -rw-r--r-- | tests/plugins/show/test.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/plugins/show/test.lua b/tests/plugins/show/test.lua index dea98c204..d7a59727a 100644 --- a/tests/plugins/show/test.lua +++ b/tests/plugins/show/test.lua @@ -1,5 +1,26 @@ import("core.base.json") +function test_list_targets_json_format(t) + local outdata = os.iorunv("xmake", {"show", "-l", "targets", "--format=json"}) + local targets = json.decode(outdata) + + t:require(table.contains(targets, "app")) + t:require(table.contains(targets, "core")) + t:require(table.contains(targets, "ui")) +end + +function test_list_targets_plain_format(t) + local outdata = os.iorunv("xmake", {"show", "-l", "targets", "--format=plain"}) + t:require(outdata:find("app", 1, true)) + t:require(outdata:find("core", 1, true)) + t:require(outdata:find("ui", 1, true)) +end + +function test_list_targets_unsupported_format(t) + local ok = try { function () os.execv("xmake", {"show", "-l", "targets", "--format=dot"}) end } + t:require(not ok) +end + function test_depgraph_json(t) local outdata = os.iorunv("xmake", {"show", "--info=depgraph", "--json"}) local graph = json.decode(outdata) |
