Skip to content

Commit

Permalink
[Tests] Fix the template for test generation when there is a CHAR_STR…
Browse files Browse the repository at this point in the history
…ING variable used for a test only cluster (#15042)
  • Loading branch information
vivien-apple authored Feb 11, 2022
1 parent 9ce1b55 commit cd9ba4f
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 84 deletions.
11 changes: 6 additions & 5 deletions examples/chip-tool/templates/partials/test_cluster.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,14 @@ class {{filename}}: public TestCommand
CHIP_ERROR {{>testCommand}}()
{
SetIdentity(kIdentity{{asUpperCamelCase identity}});
return {{command}}({{#chip_tests_item_parameters}}{{#not_first}}, {{/not_first}}{{#if (isString type)}}"{{/if~}}
return {{command}}({{#chip_tests_item_parameters}}{{#not_first}},{{/not_first}}
{{#*inline "defaultValue"}}{{asTypedLiteral (chip_tests_config_get_default_value definedValue) (chip_tests_config_get_type definedValue)}}{{/inline}}
{{~#if (chip_tests_config_has definedValue)~}}
m{{asUpperCamelCase definedValue}}.HasValue() ? m{{asUpperCamelCase definedValue}}.Value() : {{asTypedLiteral (chip_tests_config_get_default_value definedValue) (chip_tests_config_get_type definedValue)}}
{{else}}
{{definedValue}}
m{{asUpperCamelCase definedValue}}.HasValue() ? m{{asUpperCamelCase definedValue}}.Value() : {{~#if (isString type)}}chip::CharSpan::fromCharString("{{>defaultValue}}"){{else}}{{>defaultValue}}{{/if~}}
{{~else if (isString type)}}"{{definedValue}}"
{{else}}{{definedValue}}
{{~/if~}}
{{~#if (isString type)}}"{{/if}}{{/chip_tests_item_parameters}});
{{/chip_tests_item_parameters}});
}
{{else if isWait}}
CHIP_ERROR {{>testCommand}}()
Expand Down
Loading

0 comments on commit cd9ba4f

Please sign in to comment.