fix: issue #20 cmd-J panel tab strip visibility and output panel parity
This commit is contained in:
@@ -34,6 +34,57 @@ defmodule BDS.Scripting.LuaTest do
|
||||
assert_receive {:progress, %{"phase" => "write", "current" => 2, "total" => 2}}
|
||||
end
|
||||
|
||||
test "streams bds.app.log output through the on_output callback" do
|
||||
parent = self()
|
||||
|
||||
source = """
|
||||
function main()
|
||||
bds.app.log('fetching')
|
||||
bds.app.log('done', 42)
|
||||
return 'ok'
|
||||
end
|
||||
"""
|
||||
|
||||
callback = fn text -> send(parent, {:script_output, text}) end
|
||||
|
||||
assert {:ok, "ok"} =
|
||||
BDS.Scripting.execute_project_script("project-id", source, "main", [],
|
||||
on_output: callback
|
||||
)
|
||||
|
||||
assert_receive {:script_output, "fetching"}
|
||||
assert_receive {:script_output, "done 42"}
|
||||
end
|
||||
|
||||
test "routes print calls through the on_output callback" do
|
||||
parent = self()
|
||||
|
||||
source = """
|
||||
function main()
|
||||
print('hello', 'world')
|
||||
return 'ok'
|
||||
end
|
||||
"""
|
||||
|
||||
callback = fn text -> send(parent, {:script_output, text}) end
|
||||
|
||||
assert {:ok, "ok"} = BDS.Scripting.execute(source, "main", [], on_output: callback)
|
||||
|
||||
assert_receive {:script_output, "hello world"}
|
||||
end
|
||||
|
||||
test "log and print fall back to a silent sink without an on_output callback" do
|
||||
source = """
|
||||
function main()
|
||||
bds.app.log('note')
|
||||
print('hello')
|
||||
return 'ok'
|
||||
end
|
||||
"""
|
||||
|
||||
assert {:ok, "ok"} = BDS.Scripting.execute_project_script("project-id", source, "main", [])
|
||||
end
|
||||
|
||||
test "sandbox blocks os.execute" do
|
||||
source = "function main() os.execute('echo hacked') end"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user