Update Lua API docs for ref_target field, add tests
parent
df6f3a0455
commit
1f1bb5a055
@ -0,0 +1,35 @@
|
||||
function test.get()
|
||||
dfhack.with_temp_object(df.unit:new(), function(unit)
|
||||
expect.eq(unit:_field('hist_figure_id').ref_target, df.historical_figure)
|
||||
end)
|
||||
end
|
||||
|
||||
function test.get_nil()
|
||||
dfhack.with_temp_object(df.coord:new(), function(coord)
|
||||
expect.nil_(coord:_field('x').ref_target)
|
||||
end)
|
||||
end
|
||||
|
||||
function test.get_non_primitive()
|
||||
dfhack.with_temp_object(df.unit:new(), function(unit)
|
||||
expect.error_match(function()
|
||||
return unit:_field('status').ref_target
|
||||
end, 'not found')
|
||||
end)
|
||||
end
|
||||
|
||||
function test.set()
|
||||
dfhack.with_temp_object(df.unit:new(), function(unit)
|
||||
expect.error_match(function()
|
||||
unit:_field('hist_figure_id').ref_target = df.coord
|
||||
end, 'builtin property or method')
|
||||
end)
|
||||
end
|
||||
|
||||
function test.set_non_primitive()
|
||||
dfhack.with_temp_object(df.unit:new(), function(unit)
|
||||
expect.error_match(function()
|
||||
unit:_field('status').ref_target = df.coord
|
||||
end, 'not found')
|
||||
end)
|
||||
end
|
Loading…
Reference in New Issue