Skip to content

Commit

Permalink
Added missing tests to kernel32 and DbgHelp.
Browse files Browse the repository at this point in the history
These tests are to verify the generation issue on the functions tested in this code.

Signed-off-by: AraHaan <seandhunt_7@yahoo.com>
  • Loading branch information
AraHaan committed Apr 28, 2021
1 parent 2216f3e commit 26faf0d
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,9 @@ MigrationBackup/

# dotnet tool local install directory
.store/

# JetBrains Rider on Mac can generate these .DS_Store files on every folder in the repository.
.DS_Store

# Ignore these from rider too.
.idea/
61 changes: 61 additions & 0 deletions test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,67 @@ public void GetLastErrorNotIncludedInBulkGeneration()
Assert.False(this.IsMethodGenerated("GetLastError"));
}

/// <summary>
/// Verifies that GetCurrentProcess is generated.
/// </summary>
[Fact]
public void GetGetCurrentProcessGeneration()
{
this.generator = new Generator(this.metadataStream, DefaultTestGeneratorOptions, this.compilation, this.parseOptions);
Assert.True(this.generator.TryGenerate("GetCurrentProcess", CancellationToken.None));
this.CollectGeneratedCode(this.generator);
Assert.True(this.IsMethodGenerated("GetCurrentProcess"));
}

/// <summary>
/// Verifies that GetCurrentProcessId is generated.
/// </summary>
[Fact]
public void GetGetCurrentProcessIdGeneration()
{
this.generator = new Generator(this.metadataStream, DefaultTestGeneratorOptions, this.compilation, this.parseOptions);
Assert.True(this.generator.TryGenerate("GetCurrentProcessId", CancellationToken.None));
this.CollectGeneratedCode(this.generator);
Assert.True(this.IsMethodGenerated("GetCurrentProcessId"));
}

/// <summary>
/// Verifies that GetCurrentThreadId is generated.
/// </summary>
[Fact]
public void GetGetCurrentThreadIdGeneration()
{
this.generator = new Generator(this.metadataStream, DefaultTestGeneratorOptions, this.compilation, this.parseOptions);
Assert.True(this.generator.TryGenerate("GetCurrentThreadId", CancellationToken.None));
this.CollectGeneratedCode(this.generator);
Assert.True(this.IsMethodGenerated("GetCurrentThreadId"));
}

/// <summary>
/// Verifies that the MINIDUMP_TYPE enum is generated.
/// </summary>
[Fact]
public void GetMINIDUMP_TYPEGeneration()
{
this.generator = new Generator(this.metadataStream, DefaultTestGeneratorOptions, this.compilation, this.parseOptions);
Assert.True(this.generator.TryGenerate("MINIDUMP_TYPE", CancellationToken.None));
this.CollectGeneratedCode(this.generator);
Assert.Equal("MINIDUMP_TYPE" is object, this.generator.TryGetEnumName("MINIDUMP_TYPE", out string? actualDeclaringEnum));
Assert.Equal("MINIDUMP_TYPE", actualDeclaringEnum);
}

/// <summary>
/// Verifies that MiniDumpWriteDump is generated.
/// </summary>
[Fact]
public void GetMiniDumpWriteDumpGeneration()
{
this.generator = new Generator(this.metadataStream, DefaultTestGeneratorOptions, this.compilation, this.parseOptions);
Assert.True(this.generator.TryGenerate("MiniDumpWriteDump", CancellationToken.None));
this.CollectGeneratedCode(this.generator);
Assert.True(this.IsMethodGenerated("MiniDumpWriteDump"));
}

[Fact]
public void FriendlyOverloadOfCOMInterfaceRemovesParameter()
{
Expand Down

0 comments on commit 26faf0d

Please sign in to comment.