Skip to content

Commit 245748f

Browse files
authored
Add corner test cases related to optional values and maps to codify behavior (#462)
Signed-off-by: Justin King <jcking@google.com>
1 parent 8309f96 commit 245748f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/simple/testdata/optionals.textproto

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,4 +433,19 @@ section: {
433433
expr: "optional.of(1) != optional.of(1)"
434434
value: { bool_value: false }
435435
}
436+
test {
437+
name: "map_optional_has"
438+
expr: "has({'foo': optional.none()}.foo)"
439+
value: { bool_value: true }
440+
}
441+
test {
442+
name: "map_optional_select_has"
443+
expr: "has({'foo': optional.none()}.foo.bar)"
444+
value: { bool_value: false }
445+
}
446+
test {
447+
name: "map_optional_entry_has"
448+
expr: "has({?'foo': optional.none()}.foo)"
449+
value: { bool_value: false }
450+
}
436451
}

0 commit comments

Comments
 (0)