There were some places that were testing optionals, most of them were only tangential and were left as-is,
for example, type-aliases can't use an optional underlying type, or enums can't use an optional backing type.
These tests were specific to a type and just happened to involve optionals, so best to leave them alone.
2 tests were moved though:
supported_optional_types_succeed: this checks that marking primitive types optional works in Slice2. IMO, this belongs in optional::slice2 more than primitive::encoding, so I moved it. Doesn't really have anything to do with encoding.
non_tagged_optional_types_fail: this is really checking that optionals are disallowed with Slice1, and it's about untagged parameters, so it's weird to be in tag_tests anyways IMO.
This PR adds a comprehensive list of tests for optional types (addressing https://github.com/icerpc/slicec/issues/436).
There were some places that were testing optionals, most of them were only tangential and were left as-is, for example, type-aliases can't use an optional underlying type, or enums can't use an optional backing type. These tests were specific to a type and just happened to involve optionals, so best to leave them alone.
2 tests were moved though:
supported_optional_types_succeed
: this checks that marking primitive types optional works in Slice2. IMO, this belongs inoptional::slice2
more thanprimitive::encoding
, so I moved it. Doesn't really have anything to do with encoding.non_tagged_optional_types_fail
: this is really checking that optionals are disallowed with Slice1, and it's about untagged parameters, so it's weird to be intag_tests
anyways IMO.