diff options
| author | ruki <[email protected]> | 2026-02-02 23:49:48 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-02 23:49:48 +0800 |
| commit | 1e9e8d25b8180d05ac8c99073f31cd6b085dc4a9 (patch) | |
| tree | 28d7dfae956fb93068aea91a07cb365daa72f3e8 /tests/modules/stdin/test.lua | |
| parent | 2e1c785938ae107734f4e4f1c36e57feae71aca6 (diff) | |
Update test.lua
Diffstat (limited to 'tests/modules/stdin/test.lua')
| -rw-r--r-- | tests/modules/stdin/test.lua | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/modules/stdin/test.lua b/tests/modules/stdin/test.lua index 6c9d49587..351955f71 100644 --- a/tests/modules/stdin/test.lua +++ b/tests/modules/stdin/test.lua @@ -1,4 +1,3 @@ -import("core.base.binutils") import("lib.detect.find_tool") function _run_sh(t, name, cmd, expect) @@ -20,12 +19,14 @@ function _run_cmd(t, name, cmd, expect) end function _run_pwsh(t, name, cmd, expect) - local xmake = path.translate(os.programfile()) - local run_stdin = string.format('"%s" l --stdin', xmake) - local pwsh = find_tool("powershell") - if pwsh then - local outdata = os.iorunv(pwsh.program, {"-c", cmd .. " | " .. run_stdin}) or "" - t:are_equal(outdata:trim(), expect) + if is_host("windows") then + local xmake = path.translate(os.programfile()) + local run_stdin = string.format('"%s" l --stdin', xmake) + local pwsh = find_tool("powershell") + if pwsh then + local outdata = os.iorunv(pwsh.program, {"-c", cmd .. " | " .. run_stdin}) or "" + t:are_equal(outdata:trim(), expect) + end end end @@ -47,5 +48,5 @@ function test_pwsh(t) _run_pwsh(t, "pwsh_single", "echo \"print('hello_pwsh')\"", "hello_pwsh") _run_pwsh(t, "pwsh_calc", "echo \"local f = 1+1; print(f)\"", "2") _run_pwsh(t, "pwsh_main", "echo \"function main() print('in_pwsh_main') end\"", "in_pwsh_main") - _run_pwsh(t, "pwsh_multi", "echo \"print('pline1')\"; echo \"print('pline2')\"", "pline1\r\npline2") + _run_pwsh(t, "pwsh_multi", "echo \"print('pline1')`nprint('pline2')\"", "pline1\r\npline2") end |
