wesnoth/data/test/scenarios/test_lua_wml.cfg
Steve Cotton adf39d3d4a Fix the indentation in test_lua_wml
This main change here is moving tags to their own line, to avoid wmlindent
bug #1397. The lua gets a manual tabs-to-spaces conversion.
2021-04-15 20:32:42 +02:00

88 lines
1.8 KiB
INI

# wmllint: no translatables
{GENERIC_UNIT_TEST "test_wml_actions" (
[event]
name = start
[lua]
code = <<
function wesnoth.wml_actions.foo(cfg)
if cfg.bar then
wml.variables["result"] = cfg.bar
end
end
>>
[/lua]
{VARIABLE result 0}
{ASSERT {VARIABLE_CONDITIONAL result equals 0}}
[foo]
bar = 1
[/foo]
{ASSERT {VARIABLE_CONDITIONAL result equals "1"}}
[foo]
baz = 0
[/foo]
{ASSERT {VARIABLE_CONDITIONAL result equals "1"}}
[foo]
bar = 2
[/foo]
{RETURN {VARIABLE_CONDITIONAL result equals "2"}}
[/event]
)}
{GENERIC_UNIT_TEST "test_wml_conditionals" (
[event]
name = start
[lua]
code = <<
function wesnoth.wml_conditionals.foo(cfg)
return (cfg.bar == "baz")
end
>>
[/lua]
{ASSERT (
[foo]
bar = "baz"
[/foo]
)}
{ASSERT (
[not]
[foo]
bar = "boo"
[/foo]
[/not]
)}
{ASSERT (
[foo]
bar = "baz"
[/foo]
[or]
[foo]
bar = "boo"
[/foo]
[/or]
)}
{ASSERT (
[not]
[foo]
bar = "baz"
[/foo]
[and]
[foo]
bar = "boo"
[/foo]
[/and]
[/not]
)}
{SUCCEED}
[/event]
)}