brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 8db5ccb Raw
42 lines · plain
1_T = require('lua_lldb_test').create_test('TestFileHandle')2 3function _T:TestLegacyFileOutScript()4    local f = io.open(self.output, 'w')5    local sbf = lldb.SBFile(f)6    self.debugger:SetOutputFile(sbf)7    self:handle_command('script print(1+1)')8    self.debugger:GetOutputFileHandle():write('FOO\n')9    self.debugger:GetOutputFileHandle():flush()10    f:close()11 12    f = io.open(self.output, 'r')13    assertEqual(read_file_non_empty_lines(f), {'2', 'FOO'})14    f:close()15end16 17function _T:TestLegacyFileOut()18    local f = io.open(self.output, 'w')19    local sbf = lldb.SBFile(f)20    self.debugger:SetOutputFile(sbf)21    self:handle_command('expression/x 3735928559', false)22    f:close()23 24    f = io.open(self.output, 'r')25    assertStrContains(f:read('*l'), 'deadbeef')26    f:close()27end28 29function _T:TestLegacyFileErr()30    local f = io.open(self.output, 'w')31    local sbf = lldb.SBFile(f)32    self.debugger:SetErrorFile(sbf)33    self:handle_command('lol', false)34    f:close()35 36    f = io.open(self.output, 'r')37    assertStrContains(f:read('*l'), 'is not a valid command')38    f:close()39end40 41os.exit(_T:run())42