Files
clang-p2996/lldb/test/API/lua_api/TestFileHandle.lua
Dave Lee 4076664228 [lldb][test] Replace use of p with expression (NFC)
In API tests, replace use of the `p` alias with the `expression` command.

To avoid conflating tests of the alias with tests of the expression command,
this patch canonicalizes to the use `expression`.

Differential Revision: https://reviews.llvm.org/D141539
2023-01-25 11:03:58 -08:00

38 lines
1010 B
Lua

_T = require('lua_lldb_test').create_test('TestFileHandle')
function _T:TestLegacyFileOutScript()
local f = io.open(self.output, 'w')
self.debugger:SetOutputFile(f)
self:handle_command('script print(1+1)')
self.debugger:GetOutputFileHandle():write('FOO\n')
self.debugger:GetOutputFileHandle():flush()
f:close()
f = io.open(self.output, 'r')
assertEquals(read_file_non_empty_lines(f), {'2', 'FOO'})
f:close()
end
function _T:TestLegacyFileOut()
local f = io.open(self.output, 'w')
self.debugger:SetOutputFile(f)
self:handle_command('expression/x 3735928559', false)
f:close()
f = io.open(self.output, 'r')
assertStrContains(f:read('*l'), 'deadbeef')
f:close()
end
function _T:TestLegacyFileErr()
local f = io.open(self.output, 'w')
self.debugger:SetErrorFile(f)
self:handle_command('lol', false)
f = io.open(self.output, 'r')
assertStrContains(f:read('*l'), 'is not a valid command')
f:close()
end
os.exit(_T:run())