Skip to content

Commit a77f9a6

Browse files
authored
More field validation tests (#1068)
For {extension,non-extension} {singular,repeated} fields, check range and type checks. All fields with range checks are tested. For type and nullability checks we only use a message and a `bool` field, as there are too many types of fields and most of them use the same validation function. Fields with range checks are not tested for type and nullability checks. To check whether a value is within range we have to use as a non-null `int` or `double`, so if the value being checked doesn't have the right type the range check function will throw anyway. This reveals two inconsistencies in the library: - When type of a non-repeated extension value is not right we throw an argument error instead of a type error. - `setExtension` takes an `Object` (not nullable) as an argument but `addExtension` takes `Object?` (nullable). I tested accordingly instead of trying to fix the inconsistencies as fixing them will break downstream.
1 parent 27730db commit a77f9a6

File tree

1 file changed

+413
-20
lines changed

1 file changed

+413
-20
lines changed

0 commit comments

Comments
 (0)