Improved the [role] unit test
A new unit test, called 'test_role_lua' was added, to ensure that the [role] tag could be used from Lua. Also, in the first unit test the types list is stored in a variable, to ensure that variable substitution works as intended
This commit is contained in:
parent
79d44d0486
commit
d4a3c76447
2 changed files with 42 additions and 1 deletions
|
@ -12,10 +12,15 @@
|
|||
[event]
|
||||
name=start
|
||||
|
||||
[set_variable]
|
||||
name=roles
|
||||
value=Spectre,Nightgaunt,Wraith,Shadow,Ghost
|
||||
[/set_variable]
|
||||
|
||||
[role]
|
||||
role=advisor
|
||||
side=1
|
||||
type=Spectre,Nightgaunt,Wraith,Shadow,Ghost
|
||||
type=$roles
|
||||
[/role]
|
||||
|
||||
[recall]
|
||||
|
@ -90,3 +95,38 @@
|
|||
{RETURN ([true][/true])}
|
||||
[/event]
|
||||
)}
|
||||
|
||||
{GENERIC_UNIT_TEST "test_role_lua" (
|
||||
[event]
|
||||
name=start
|
||||
|
||||
{UNIT 1 "Dwarvish Thunderguard" recall recall (id=wrong_0)}
|
||||
{UNIT 1 "Dwarvish Steelclad" recall recall (id=correct)}
|
||||
{UNIT 1 "Dwarvish Fighter" recall recall (id=wrong_1)}
|
||||
{UNIT 1 "Dwarvish Thunderer" recall recall (id=wrong_2)}
|
||||
|
||||
[lua]
|
||||
code=<<
|
||||
local types = "Dwarvish Steelclad,Dwarvish Thunderguard,Dwarvish Fighter,Dwarvish Thunderer"
|
||||
|
||||
wesnoth.wml_actions.role { type = types, role = "scout" }
|
||||
>>
|
||||
[/lua]
|
||||
|
||||
[recall]
|
||||
role=scout
|
||||
[/recall]
|
||||
|
||||
{ASSERT (
|
||||
[have_unit]
|
||||
role=scout
|
||||
side=1
|
||||
type=Dwarvish Steelclad
|
||||
id=correct
|
||||
search_recall_list=no
|
||||
[/have_unit]
|
||||
)}
|
||||
|
||||
{RETURN ([true][/true])}
|
||||
[/event]
|
||||
)}
|
||||
|
|
|
@ -90,6 +90,7 @@
|
|||
0 test_role_1
|
||||
0 test_role_2
|
||||
0 test_role_3
|
||||
0 test_role_lua
|
||||
#
|
||||
# LUA
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue