-
Notifications
You must be signed in to change notification settings - Fork 5
Update to protovalidate 0.10.3 #73
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
Changes from 7 commits
78146eb
42b0b9b
55cefd2
6ba8d29
ea93e53
7d1489b
7be3304
95aa599
3302903
bdc7913
8293f39
1cfeaa5
018a695
b410fcf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,8 +22,8 @@ | |
#include "eval/public/activation.h" | ||
#include "eval/public/builtin_func_registrar.h" | ||
#include "eval/public/cel_expr_builder_factory.h" | ||
#include "gtest/gtest.h" | ||
#include "gmock/gmock.h" | ||
#include "gtest/gtest.h" | ||
#include "parser/parser.h" | ||
|
||
namespace buf::validate { | ||
|
@@ -201,7 +201,8 @@ TEST(ValidatorTest, ValidateBadURIRefFailure) { | |
ASSERT_TRUE(violations_or.ok()) << violations_or.status(); | ||
EXPECT_EQ(violations_or.value().violations_size(), 1); | ||
EXPECT_EQ(violations_or.value().violations(0).proto().constraint_id(), "string.uri_ref"); | ||
EXPECT_EQ(violations_or.value().violations(0).proto().message(), "value must be a valid URI"); | ||
EXPECT_EQ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verified my local clang-formatter is using the repo's clang-format rules. |
||
violations_or.value().violations(0).proto().message(), "value must be a valid URI Reference"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the actual test fix. No idea how this was ever passing. |
||
EXPECT_THAT( | ||
violations_or.value().violations(0).field_value(), | ||
Optional(FieldValueOf(VariantWith<std::string>("!@#$%^&*")))); | ||
|
@@ -249,7 +250,8 @@ TEST(ValidatorTest, ValidateStringContainsFailure) { | |
EXPECT_EQ(violations_or.value().violations_size(), 1); | ||
EXPECT_EQ(violations_or.value().violations(0).proto().constraint_id(), "string.contains"); | ||
EXPECT_EQ( | ||
violations_or.value().violations(0).proto().message(), "value does not contain substring `bar`"); | ||
violations_or.value().violations(0).proto().message(), | ||
"value does not contain substring `bar`"); | ||
} | ||
|
||
TEST(ValidatorTest, ValidateStringContainsSuccess) { | ||
|
@@ -305,7 +307,8 @@ TEST(ValidatorTest, ValidateStartsWithFailure) { | |
ASSERT_TRUE(violations_or.ok()) << violations_or.status(); | ||
EXPECT_EQ(violations_or.value().violations_size(), 1); | ||
EXPECT_EQ(violations_or.value().violations(0).proto().constraint_id(), "string.prefix"); | ||
EXPECT_EQ(violations_or.value().violations(0).proto().message(), "value does not have prefix `foo`"); | ||
EXPECT_EQ( | ||
violations_or.value().violations(0).proto().message(), "value does not have prefix `foo`"); | ||
} | ||
|
||
TEST(ValidatorTest, ValidateStartsWithSuccess) { | ||
|
@@ -333,7 +336,8 @@ TEST(ValidatorTest, ValidateEndsWithFailure) { | |
ASSERT_TRUE(violations_or.ok()) << violations_or.status(); | ||
EXPECT_EQ(violations_or.value().violations_size(), 1); | ||
EXPECT_EQ(violations_or.value().violations(0).proto().constraint_id(), "string.suffix"); | ||
EXPECT_EQ(violations_or.value().violations(0).proto().message(), "value does not have suffix `baz`"); | ||
EXPECT_EQ( | ||
violations_or.value().violations(0).proto().message(), "value does not have suffix `baz`"); | ||
} | ||
|
||
TEST(ValidatorTest, ValidateHostnameSuccess) { | ||
|
@@ -415,11 +419,13 @@ TEST(ValidatorTest, MessageConstraint) { | |
auto violations_or = validator.Validate(message_expressions); | ||
ASSERT_TRUE(violations_or.ok()) << violations_or.status(); | ||
ASSERT_EQ(violations_or.value().violations_size(), 3); | ||
EXPECT_EQ(violations_or.value().violations(0).proto().constraint_id(), "message_expression_scalar"); | ||
EXPECT_EQ( | ||
violations_or.value().violations(0).proto().constraint_id(), "message_expression_scalar"); | ||
EXPECT_EQ(violations_or.value().violations(0).proto().message(), "a must be less than b"); | ||
EXPECT_EQ(violations_or.value().violations(1).proto().constraint_id(), "message_expression_enum"); | ||
EXPECT_EQ(violations_or.value().violations(1).proto().message(), "c must not equal d"); | ||
EXPECT_EQ(violations_or.value().violations(2).proto().constraint_id(), "message_expression_nested"); | ||
EXPECT_EQ( | ||
violations_or.value().violations(2).proto().constraint_id(), "message_expression_nested"); | ||
EXPECT_EQ(violations_or.value().violations(2).proto().message(), "a must be greater than b"); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the segfault fix. The rest are just formatting changes.