Skip to content

Commit efd8c1a

Browse files
committed
Fixing some tests to no longer expect a diagnostic
1 parent b37095c commit efd8c1a

File tree

7 files changed

+8
-40
lines changed

7 files changed

+8
-40
lines changed

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/StructDeclarationTest.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ public ref {expectedManagedType} this[int index]
5050
}}
5151
";
5252

53-
var diagnostics = new[] {
54-
new Diagnostic(DiagnosticLevel.Warning, "Found variable length array: 'MyStruct::x'. Please specify the length using `--with-length <string>`.", $"Line 3, Column {6 + expectedManagedType.Length} in ClangUnsavedFile.h"),
55-
};
56-
return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents, expectedDiagnostics: diagnostics);
53+
return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
5754
}
5855

5956
protected override Task BasicTestImpl(string nativeType, string expectedManagedType)
@@ -1916,21 +1913,10 @@ public partial struct MyStruct
19161913
[NativeTypeName(""size_t[2]"")]
19171914
public _FixedBuffer_e__FixedBuffer FixedBuffer;
19181915
1916+
[InlineArray(2)]
19191917
public partial struct _FixedBuffer_e__FixedBuffer
19201918
{
19211919
public nuint e0;
1922-
1923-
[UnscopedRef]
1924-
public ref nuint this[int index]
1925-
{
1926-
get
1927-
{
1928-
return ref AsSpan()[index];
1929-
}
1930-
}
1931-
1932-
[UnscopedRef]
1933-
public Span<nuint> AsSpan() => MemoryMarshal.CreateSpan(ref e0, 2);
19341920
}
19351921
}
19361922
}

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/StructDeclarationTest.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ public ref {expectedManagedType} this[int index]
5050
}}
5151
";
5252

53-
var diagnostics = new[] {
54-
new Diagnostic(DiagnosticLevel.Warning, "Found variable length array: 'MyStruct::x'. Please specify the length using `--with-length <string>`.", $"Line 3, Column {6 + expectedManagedType.Length} in ClangUnsavedFile.h"),
55-
};
56-
return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents, expectedDiagnostics: diagnostics);
53+
return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
5754
}
5855

5956
protected override Task BasicTestImpl(string nativeType, string expectedManagedType)

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/StructDeclarationTest.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ public ref {expectedManagedType} this[int index]
5050
}}
5151
";
5252

53-
var diagnostics = new[] {
54-
new Diagnostic(DiagnosticLevel.Warning, "Found variable length array: 'MyStruct::x'. Please specify the length using `--with-length <string>`.", $"Line 3, Column {6 + expectedManagedType.Length} in ClangUnsavedFile.h"),
55-
};
56-
return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents, expectedDiagnostics: diagnostics);
53+
return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
5754
}
5855

5956
protected override Task BasicTestImpl(string nativeType, string expectedManagedType)

tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/StructDeclarationTest.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ protected override Task IncompleteArraySizeTestImpl(string nativeType, string ex
5252
</bindings>
5353
";
5454

55-
var diagnostics = new[] {
56-
new Diagnostic(DiagnosticLevel.Warning, "Found variable length array: 'MyStruct::x'. Please specify the length using `--with-length <string>`.", $"Line 3, Column {6 + expectedManagedType.Length} in ClangUnsavedFile.h"),
57-
};
58-
return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents, expectedDiagnostics: diagnostics);
55+
return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
5956
}
6057

6158
protected override Task BasicTestImpl(string nativeType, string expectedManagedType)

tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/StructDeclarationTest.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ protected override Task IncompleteArraySizeTestImpl(string nativeType, string ex
5252
</bindings>
5353
";
5454

55-
var diagnostics = new[] {
56-
new Diagnostic(DiagnosticLevel.Warning, "Found variable length array: 'MyStruct::x'. Please specify the length using `--with-length <string>`.", $"Line 3, Column {6 + expectedManagedType.Length} in ClangUnsavedFile.h"),
57-
};
58-
return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents, expectedDiagnostics: diagnostics);
55+
return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
5956
}
6057

6158
protected override Task BasicTestImpl(string nativeType, string expectedManagedType)

tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/StructDeclarationTest.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ protected override Task IncompleteArraySizeTestImpl(string nativeType, string ex
5252
</bindings>
5353
";
5454

55-
var diagnostics = new[] {
56-
new Diagnostic(DiagnosticLevel.Warning, "Found variable length array: 'MyStruct::x'. Please specify the length using `--with-length <string>`.", $"Line 3, Column {6 + expectedManagedType.Length} in ClangUnsavedFile.h"),
57-
};
58-
return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents, expectedDiagnostics: diagnostics);
55+
return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
5956
}
6057

6158
protected override Task BasicTestImpl(string nativeType, string expectedManagedType)

tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/StructDeclarationTest.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ protected override Task IncompleteArraySizeTestImpl(string nativeType, string ex
5252
</bindings>
5353
";
5454

55-
var diagnostics = new[] {
56-
new Diagnostic(DiagnosticLevel.Warning, "Found variable length array: 'MyStruct::x'. Please specify the length using `--with-length <string>`.", $"Line 3, Column {6 + expectedManagedType.Length} in ClangUnsavedFile.h"),
57-
};
58-
return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents, expectedDiagnostics: diagnostics);
55+
return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
5956
}
6057

6158
protected override Task BasicTestImpl(string nativeType, string expectedManagedType)

0 commit comments

Comments
 (0)