Skip to content

Commit

Permalink
SE - Non-nullable value types: Add SizeOf tests (#6906)
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-strecker-sonarsource authored Mar 14, 2023
1 parent 03668db commit 659c27c
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,17 @@ public void InstanceReference_SetsNotNull_CS()
validator.ValidateTag("This", x => x.HasConstraint(ObjectConstraint.NotNull).Should().BeTrue());
}

[TestMethod]
public void SizeOf_SetNotNullconstraint()
{
var code = """
var size = sizeof(int);
Tag("Size", size);
""";
var validator = SETestContext.CreateCS(code).Validator;
validator.ValidateTag("Size", x => x.Should().HaveOnlyConstraint(ObjectConstraint.NotNull));
}

[DataTestMethod]
[DataRow("[ValidatedNotNull]")]
[DataRow("[ValidatedNotNullAttribute]")]
Expand Down

0 comments on commit 659c27c

Please sign in to comment.