Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String RegexMatches validator #23

Merged
merged 4 commits into from
May 25, 2022
Merged

String RegexMatches validator #23

merged 4 commits into from
May 25, 2022

Conversation

ewbankkit
Copy link
Contributor

Closes #10.

% go test -v -run=TestRegexMatchesValidator ./stringvalidator
=== RUN   TestRegexMatchesValidator
=== PAUSE TestRegexMatchesValidator
=== CONT  TestRegexMatchesValidator
=== RUN   TestRegexMatchesValidator/not_a_String
=== RUN   TestRegexMatchesValidator/unknown_String
=== RUN   TestRegexMatchesValidator/null_String
=== RUN   TestRegexMatchesValidator/valid_String
=== RUN   TestRegexMatchesValidator/invalid_String
--- PASS: TestRegexMatchesValidator (0.00s)
    --- PASS: TestRegexMatchesValidator/not_a_String (0.00s)
    --- PASS: TestRegexMatchesValidator/unknown_String (0.00s)
    --- PASS: TestRegexMatchesValidator/null_String (0.00s)
    --- PASS: TestRegexMatchesValidator/valid_String (0.00s)
    --- PASS: TestRegexMatchesValidator/invalid_String (0.00s)
PASS
ok  	github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator	0.700s

@ewbankkit ewbankkit marked this pull request as ready for review May 25, 2022 13:14
@ewbankkit ewbankkit requested a review from a team as a code owner May 25, 2022 13:14
@bflad bflad self-assigned this May 25, 2022
@bflad bflad added enhancement New feature or request type/string types.String validators labels May 25, 2022
@bflad bflad added this to the v0.1.0 milestone May 25, 2022
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much, @ewbankkit 🚀


for name, test := range tests {
name, test := name, test
t.Run(name, func(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but I just realized that we can add t.Parallel() here for the sub tests 👍

type testCase struct {
val attr.Value
regexp *regexp.Regexp
expectError bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but it'd be great to switch at least this unit test to checking contents to ensure a given message flows to the returned error diagnostic.

Copy link
Contributor

@detro detro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only 1 request for change.

Overall looks great.

@bflad bflad merged commit c6cc80d into hashicorp:main May 25, 2022
@ewbankkit ewbankkit deleted the f-string-match-validation branch May 25, 2022 13:37
bflad added a commit that referenced this pull request May 25, 2022
bflad added a commit that referenced this pull request May 26, 2022
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request type/string types.String validators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

String Regular Expression Matching
3 participants