-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #229 from csoltenborn/#227_FixHandlingOfNamespaces
bugfix: source locations for tests contained in namespaces are found again (#227)
- Loading branch information
Showing
20 changed files
with
247 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
GoogleTestAdapter/Core.Tests/TestCases/TestCaseResolverTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using System.Linq; | ||
using FluentAssertions; | ||
using GoogleTestAdapter.DiaResolver; | ||
using GoogleTestAdapter.Helpers; | ||
using GoogleTestAdapter.Tests.Common; | ||
using GoogleTestAdapter.Tests.Common.Fakes; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using static GoogleTestAdapter.Tests.Common.TestMetadata.TestCategories; | ||
|
||
namespace GoogleTestAdapter.TestCases | ||
{ | ||
|
||
[TestClass] | ||
public class TestCaseResolverTests : TestsBase | ||
{ | ||
private FakeLogger _fakeLogger; | ||
|
||
[TestInitialize] | ||
public void Setup() | ||
{ | ||
_fakeLogger = new FakeLogger(() => true, false); | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory(Integration)] | ||
public void FindTestCaseLocation_Namespace_Named_LocationIsFound() | ||
{ | ||
AssertCorrectTestLocationIsFound("Namespace_Named", 9); | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory(Integration)] | ||
public void FindTestCaseLocation_Namespace_Named_Named_LocationIsFound() | ||
{ | ||
AssertCorrectTestLocationIsFound("Namespace_Named_Named", 16); | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory(Integration)] | ||
public void FindTestCaseLocation_Namespace_Named_Anon_LocationIsFound() | ||
{ | ||
AssertCorrectTestLocationIsFound("Namespace_Named_Anon", 25); | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory(Integration)] | ||
public void FindTestCaseLocation_Namespace_Anon_LocationIsFound() | ||
{ | ||
AssertCorrectTestLocationIsFound("Namespace_Anon", 35); | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory(Integration)] | ||
public void FindTestCaseLocation_Namespace_Anon_Anon_LocationIsFound() | ||
{ | ||
AssertCorrectTestLocationIsFound("Namespace_Anon_Anon", 42); | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory(Integration)] | ||
public void FindTestCaseLocation_Namespace_Anon_Named_LocationIsFound() | ||
{ | ||
AssertCorrectTestLocationIsFound("Namespace_Anon_Named", 51); | ||
} | ||
|
||
private void AssertCorrectTestLocationIsFound(string suite, uint line) | ||
{ | ||
var descriptor = new TestCaseDescriptor( | ||
suite, | ||
"Test", | ||
$"{suite}.Test", | ||
$"{suite}.Test", | ||
TestCaseDescriptor.TestTypes.Simple); | ||
var signatures = new MethodSignatureCreator().GetTestMethodSignatures(descriptor); | ||
var resolver = new TestCaseResolver(TestResources.Tests_ReleaseX64, "", "".Yield(), | ||
new DefaultDiaResolverFactory(), true, _fakeLogger); | ||
|
||
var testCaseLocation = resolver.FindTestCaseLocation(signatures.ToList()); | ||
|
||
_fakeLogger.Errors.Should().BeEmpty(); | ||
testCaseLocation.Should().NotBeNull(); | ||
testCaseLocation.Sourcefile.Should().EndWithEquivalent(@"sampletests\tests\namespacetests.cpp"); | ||
testCaseLocation.Line.Should().Be(line); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.