-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[YAML] Add contains/excludes constraints to TestConstraints.yaml (#19042
) * Add contains/excludes constraints to TestConstraints.yaml * Add support for contains/excludes to chip-tool for simple list * Add support for contains/excludes to darwin-framework-tool for simple list * Update chip-tool generated content * Update darwin-framework-tool generated content
- Loading branch information
1 parent
8dabae0
commit fd5e78d
Showing
10 changed files
with
503 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
.../darwin-framework-tool/templates/tests/partials/checks/maybeCheckExpectedConstraints.zapt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{{#if hasExpectedConstraints}} | ||
{{~#*inline "item"}}{{asLowerCamelCase name}}{{/inline}} | ||
{{#if (hasProperty expectedConstraints "type")}}VerifyOrReturn(CheckConstraintType("{{>item}}", "", "{{expectedConstraints.type}}"));{{/if}} | ||
|
||
{{~#if (hasProperty expectedConstraints "format")}}VerifyOrReturn(CheckConstraintFormat("{{>item}}", "", "{{expectedConstraints.format}}"));{{/if}} | ||
|
||
{{~#if (hasProperty expectedConstraints "startsWith")}}VerifyOrReturn(CheckConstraintStartsWith("{{>item}}", {{>actualValue}}, "{{expectedConstraints.startsWith}}"));{{/if}} | ||
|
||
{{~#if (hasProperty expectedConstraints "endsWith")}}VerifyOrReturn(CheckConstraintEndsWith("{{>item}}", {{>actualValue}}, "{{expectedConstraints.endsWith}}"));{{/if}} | ||
|
||
{{~#if (hasProperty expectedConstraints "isUpperCase")}}VerifyOrReturn(CheckConstraintIsUpperCase("{{>item}}", {{>actualValue}}, {{expectedConstraints.isUpperCase}}));{{/if}} | ||
|
||
{{~#if (hasProperty expectedConstraints "isLowerCase")}}VerifyOrReturn(CheckConstraintIsLowerCase("{{>item}}", {{>actualValue}}, {{expectedConstraints.isLowerCase}}));{{/if}} | ||
|
||
{{~#if (hasProperty expectedConstraints "isHexString")}}VerifyOrReturn(CheckConstraintIsHexString("{{>item}}", {{>actualValue}}, {{expectedConstraints.isHexString}}));{{/if}} | ||
|
||
{{~#if (hasProperty expectedConstraints "minLength")}}VerifyOrReturn(CheckConstraintMinLength("{{>item}}", [{{>actualValue}} length], {{expectedConstraints.minLength}}));{{/if}} | ||
|
||
{{~#if (hasProperty expectedConstraints "maxLength")}}VerifyOrReturn(CheckConstraintMaxLength("{{>item}}", [{{>actualValue}} length], {{expectedConstraints.maxLength}}));{{/if}} | ||
|
||
{{~#if (hasProperty expectedConstraints "minValue")}} | ||
if ({{>actualValue}} != nil) | ||
{ | ||
VerifyOrReturn(CheckConstraintMinValue<{{chipType}}>("{{>item}}", [{{>actualValue}} {{asObjectiveCNumberType "" type true}}Value], {{asTypedLiteral expectedConstraints.minValue type}})); | ||
} | ||
{{/if}} | ||
|
||
{{~#if (hasProperty expectedConstraints "maxValue")}} | ||
if ({{>actualValue}} != nil) | ||
{ | ||
VerifyOrReturn(CheckConstraintMaxValue<{{chipType}}>("{{>item}}", [{{>actualValue}} {{asObjectiveCNumberType "" type true}}Value], {{asTypedLiteral expectedConstraints.maxValue type}})); | ||
} | ||
{{/if}} | ||
|
||
{{~#if (hasProperty expectedConstraints "contains")}} | ||
if ({{>actualValue}} != nil) | ||
{ | ||
{{#chip_tests_iterate_expected_list expectedConstraints.contains}} | ||
VerifyOrReturn(CheckConstraintContains("{{asLowerCamelCase name}}", {{>actualValue}}, {{asTypedLiteral value type}})); | ||
{{/chip_tests_iterate_expected_list}} | ||
} | ||
{{/if}} | ||
|
||
{{~#if (hasProperty expectedConstraints "excludes")}} | ||
if ({{>actualValue}} != nil) | ||
{ | ||
{{#chip_tests_iterate_expected_list expectedConstraints.excludes}} | ||
VerifyOrReturn(CheckConstraintExcludes("{{asLowerCamelCase name}}", {{>actualValue}}, {{asTypedLiteral value type}})); | ||
{{/chip_tests_iterate_expected_list}} | ||
} | ||
{{/if}} | ||
|
||
{{~#if (hasProperty expectedConstraints "notValue")}} | ||
{{#if (isLiteralNull expectedConstraints.notValue)}} | ||
VerifyOrReturn(CheckValueNonNull("{{>item}}", {{>actualValue}})); | ||
{{else}} | ||
if ({{>actualValue}} != nil) | ||
{ | ||
{{#if (isString type)}} | ||
VerifyOrReturn(CheckConstraintNotValue("{{>item}}", {{>actualValue}}, {{asTypedLiteral expectedConstraints.notValue type}})); | ||
{{else}} | ||
VerifyOrReturn(CheckConstraintNotValue("{{>item}}", {{>actualValue}}, {{asTypedLiteral expectedConstraints.notValue type}})); | ||
{{/if}} | ||
} | ||
{{/if}} | ||
{{/if}} | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.