Skip to content

Commit c93eb43

Browse files
committedNov 8, 2024
[lldb] Fix TestFileHandle.lua
- Explicitly create an `SBFile`. - Add missing call to `close`. - Use `SetErrorFile` in TestLegacyFileErr.
1 parent 7844257 commit c93eb43

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎lldb/test/API/lua_api/TestFileHandle.lua

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ _T = require('lua_lldb_test').create_test('TestFileHandle')
22

33
function _T:TestLegacyFileOutScript()
44
local f = io.open(self.output, 'w')
5-
self.debugger:SetOutputFile(f)
5+
local sbf = lldb.SBFile(f)
6+
self.debugger:SetOutputFile(sbf)
67
self:handle_command('script print(1+1)')
78
self.debugger:GetOutputFileHandle():write('FOO\n')
89
self.debugger:GetOutputFileHandle():flush()
@@ -15,7 +16,8 @@ end
1516

1617
function _T:TestLegacyFileOut()
1718
local f = io.open(self.output, 'w')
18-
self.debugger:SetOutputFile(f)
19+
local sbf = lldb.SBFile(f)
20+
self.debugger:SetOutputFile(sbf)
1921
self:handle_command('expression/x 3735928559', false)
2022
f:close()
2123

@@ -26,8 +28,10 @@ end
2628

2729
function _T:TestLegacyFileErr()
2830
local f = io.open(self.output, 'w')
29-
self.debugger:SetErrorFile(f)
31+
local sbf = lldb.SBFile(f)
32+
self.debugger:SetErrorFile(sbf)
3033
self:handle_command('lol', false)
34+
f:close()
3135

3236
f = io.open(self.output, 'r')
3337
assertStrContains(f:read('*l'), 'is not a valid command')

0 commit comments

Comments
 (0)