Skip to content

Commit d9a0a0d

Browse files
Additional conformance tests for accessing a null valued field (#352)
1 parent 4f40f4a commit d9a0a0d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/simple/testdata/optionals.textproto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ section: {
2222
expr: "{'key': {}}.?key.optFlatMap(k, k.?subkey).hasValue()"
2323
value: { bool_value: false }
2424
}
25+
test {
26+
name: "map_null_entry_no_such_key"
27+
expr: "{'null_key': null}.?null_key.invalid.hasValue()"
28+
eval_error: {
29+
errors: { message: "no such key" }
30+
}
31+
}
32+
test {
33+
name: "map_undefined_entry_hasValue"
34+
expr: "{}.?null_key.invalid.hasValue()"
35+
value: { bool_value: false }
36+
}
2537
test {
2638
name: "map_submap_subkey_optFlatMap_value"
2739
expr: "{'key': {'subkey': 'subvalue'}}.?key.optFlatMap(k, k.?subkey).value()"

0 commit comments

Comments
 (0)