2020-07-14 00:54:33 -06:00
|
|
|
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)
|
2021-04-03 14:30:52 -06:00
|
|
|
expect.error_match('not found', function()
|
2020-07-14 00:54:33 -06:00
|
|
|
return unit:_field('status').ref_target
|
2021-04-03 14:30:52 -06:00
|
|
|
end)
|
2020-07-14 00:54:33 -06:00
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
function test.set()
|
|
|
|
dfhack.with_temp_object(df.unit:new(), function(unit)
|
2021-04-03 14:30:52 -06:00
|
|
|
expect.error_match('builtin property or method', function()
|
2020-07-14 00:54:33 -06:00
|
|
|
unit:_field('hist_figure_id').ref_target = df.coord
|
2021-04-03 14:30:52 -06:00
|
|
|
end)
|
2020-07-14 00:54:33 -06:00
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
function test.set_non_primitive()
|
|
|
|
dfhack.with_temp_object(df.unit:new(), function(unit)
|
2021-04-03 14:30:52 -06:00
|
|
|
expect.error_match('not found', function()
|
2020-07-14 00:54:33 -06:00
|
|
|
unit:_field('status').ref_target = df.coord
|
2021-04-03 14:30:52 -06:00
|
|
|
end)
|
2020-07-14 00:54:33 -06:00
|
|
|
end)
|
|
|
|
end
|