forked from DFHack/dfhack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathref_target.lua
More file actions
35 lines (31 loc) · 1006 Bytes
/
Copy pathref_target.lua
File metadata and controls
35 lines (31 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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('not found', function()
return unit:_field('status').ref_target
end)
end)
end
function test.set()
dfhack.with_temp_object(df.unit:new(), function(unit)
expect.error_match('builtin property or method', function()
unit:_field('hist_figure_id').ref_target = df.coord
end)
end)
end
function test.set_non_primitive()
dfhack.with_temp_object(df.unit:new(), function(unit)
expect.error_match('not found', function()
unit:_field('status').ref_target = df.coord
end)
end)
end