Skip to content

Commit

Permalink
Fix System.Runtime tests for single file runner (dotnet#50996)
Browse files Browse the repository at this point in the history
Allows us to test the documented single file behaviors.

Not adding a new `PlatformDetection` thing for this since we don't really have a way to detect single file that wouldn't end us up testing a tautology.
  • Loading branch information
MichalStrehovsky authored Apr 19, 2021
1 parent ccc47f5 commit 6f0fd0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions eng/testing/tests.singlefile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<PropertyGroup>
<OutputType>Exe</OutputType>

<DefineConstants>$(DefineConstants);SINGLE_FILE_TEST_RUNNER</DefineConstants>

<BundleDir>$([MSBuild]::NormalizeDirectory('$(OutDir)', 'publish'))</BundleDir>
<RunScriptOutputPath>$([MSBuild]::NormalizePath('$(BundleDir)', '$(RunScriptOutputName)'))</RunScriptOutputPath>
<RuntimeIdentifier>$(PackageRID)</RuntimeIdentifier>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public void CustomAttributes()
[Fact]
public void FullyQualifiedName()
{
#if SINGLE_FILE_TEST_RUNNER
Assert.Equal("<Unknown>", Module.FullyQualifiedName);
#else
var loc = AssemblyPathHelper.GetAssemblyLocation(Assembly.GetExecutingAssembly());

// Browser will include the path (/), so strip it
Expand All @@ -90,12 +93,17 @@ public void FullyQualifiedName()
}

Assert.Equal(loc, Module.FullyQualifiedName);
#endif
}

[Fact]
public void Name()
{
#if SINGLE_FILE_TEST_RUNNER
Assert.Equal("<Unknown>", Module.Name, ignoreCase: true);
#else
Assert.Equal("system.runtime.tests.dll", Module.Name, ignoreCase: true);
#endif
}

[Fact]
Expand Down

0 comments on commit 6f0fd0a

Please sign in to comment.