Skip to content

Commit 5518940

Browse files
committed
fix to validate option argument
1 parent b71282c commit 5518940

File tree

2 files changed

+10
-0
lines changed
  • src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating
  • tests/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating

2 files changed

+10
-0
lines changed

src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.Attributes.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ GeneratorOptions options
3939
{
4040
if (attributeProvider is null)
4141
throw new ArgumentNullException(nameof(attributeProvider));
42+
if (options is null)
43+
throw new ArgumentNullException(nameof(options));
4244

4345
const string attributeSectionPrefixDefault = "[";
4446
const string attributeSectionPrefixField = "[field: ";

tests/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,4 +248,12 @@ public void GenerateExplicitBaseTypeAndInterfaces_ArgumentOptionsNull()
248248
[Test]
249249
public void GenerateExplicitBaseTypeAndInterfaces_ArgumentTypeNull()
250250
=> Assert.Throws<ArgumentNullException>(() => Generator.GenerateExplicitBaseTypeAndInterfaces(t: null!, null, options: new()));
251+
252+
[Test]
253+
public void GenerateAttributeList_ArgumentOptionsNull()
254+
=> Assert.Throws<ArgumentNullException>(() => Generator.GenerateAttributeList(attributeProvider: typeof(int), null, options: null!));
255+
256+
[Test]
257+
public void GenerateAttributeList_ArgumentAttributeProviderNull()
258+
=> Assert.Throws<ArgumentNullException>(() => Generator.GenerateAttributeList(attributeProvider: null!, null, options: new()));
251259
}

0 commit comments

Comments
 (0)