Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lua_api / TestFileHandle.lua
blobe50a1fb3dc05802ea9d7159e34195457b9a376e6
1 _T = require('lua_lldb_test').create_test('TestFileHandle')
3 function _T:TestLegacyFileOutScript()
4 local f = io.open(self.output, 'w')
5 self.debugger:SetOutputFile(f)
6 self:handle_command('script print(1+1)')
7 self.debugger:GetOutputFileHandle():write('FOO\n')
8 self.debugger:GetOutputFileHandle():flush()
9 f:close()
11 f = io.open(self.output, 'r')
12 assertEquals(read_file_non_empty_lines(f), {'2', 'FOO'})
13 f:close()
14 end
16 function _T:TestLegacyFileOut()
17 local f = io.open(self.output, 'w')
18 self.debugger:SetOutputFile(f)
19 self:handle_command('expression/x 3735928559', false)
20 f:close()
22 f = io.open(self.output, 'r')
23 assertStrContains(f:read('*l'), 'deadbeef')
24 f:close()
25 end
27 function _T:TestLegacyFileErr()
28 local f = io.open(self.output, 'w')
29 self.debugger:SetErrorFile(f)
30 self:handle_command('lol', false)
32 f = io.open(self.output, 'r')
33 assertStrContains(f:read('*l'), 'is not a valid command')
34 f:close()
35 end
37 os.exit(_T:run())