Skip to content

Commit

Permalink
Additional optional field selection tests (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
TristonianJones authored Apr 30, 2024
1 parent d9a0a0d commit 8958834
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tests/simple/testdata/optionals.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,26 @@ section: {
expr: "{'key': {}}.?key.optFlatMap(k, k.?subkey).hasValue()"
value: { bool_value: false }
}
test {
name: "map_null_entry_hasValue"
expr: "{'null_key': dyn(null)}.?null_key.hasValue()"
value: { bool_value: true }
}
test {
name: "map_null_entry_no_such_key"
expr: "{'null_key': null}.?null_key.invalid.hasValue()"
expr: "{'null_key': dyn(null)}.?null_key.invalid.hasValue()"
eval_error: {
errors: { message: "no such key" }
}
}
test {
name: "map_absent_key_absent_field_none"
expr: "{true: dyn(0)}[?false].absent.hasValue()"
value: { bool_value: false }
}
test {
name: "map_present_key_invalid_field"
expr: "{true: dyn(0)}[?true].absent.hasValue()"
eval_error: {
errors: { message: "no such key" }
}
Expand Down

0 comments on commit 8958834

Please sign in to comment.