Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/ILVerification/tests/TestDataLoader.cs')
-rw-r--r--src/ILVerification/tests/TestDataLoader.cs26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/ILVerification/tests/TestDataLoader.cs b/src/ILVerification/tests/TestDataLoader.cs
index 91a1195f8..4184a5f6f 100644
--- a/src/ILVerification/tests/TestDataLoader.cs
+++ b/src/ILVerification/tests/TestDataLoader.cs
@@ -20,19 +20,17 @@ namespace ILVerification.Tests
{
/// <summary>
/// Parses the methods in the test assemblies.
- /// It loads all assemblies from the test folder defined in <code>TestDataLoader.TESTASSEMBLYPATH</code>
+ /// It loads all assemblies from the test folder defined in <code>TestDataLoader.TestAssemblyPath</code>
/// This class feeds the xunit Theories
/// </summary>
class TestDataLoader
{
/// <summary>
- /// The folder with the binaries which are compiled from the test driver IL Code
- /// Currently the test .il code is built manually, but the plan is to have a ProjectReference and automatically build the .il files.
- /// See: https://github.com/dotnet/corert/pull/3725#discussion_r118820770
+ /// The folder with the test binaries
/// </summary>
- public static string TESTASSEMBLYPATH = @"..\..\..\ILTests\";
+ private const string TestAssemblyPath = @"Tests\";
- private const string SPECIALTEST_PREFIX = "special.";
+ private const string SpecialTestPrefix = "special.";
/// <summary>
/// Returns all methods that contain valid IL code based on the following naming convention:
@@ -129,11 +127,11 @@ namespace ILVerification.Tests
private static MethodDefinitionHandle HandleSpecialTests(string[] methodParams, EcmaMethod method)
{
- if (!methodParams[0].StartsWith(SPECIALTEST_PREFIX))
+ if (!methodParams[0].StartsWith(SpecialTestPrefix))
return method.Handle;
// Cut off special prefix
- var specialParams = methodParams[0].Substring(SPECIALTEST_PREFIX.Length);
+ var specialParams = methodParams[0].Substring(SpecialTestPrefix.Length);
// Get friendly name / special name
int delimiter = specialParams.IndexOf('.');
@@ -152,7 +150,7 @@ namespace ILVerification.Tests
private static IEnumerable<string> GetAllTestDlls()
{
- foreach (var item in Directory.GetFiles(TESTASSEMBLYPATH))
+ foreach (var item in Directory.GetFiles(TestAssemblyPath))
{
if (item.ToLower().EndsWith(".dll"))
{
@@ -167,7 +165,7 @@ namespace ILVerification.Tests
foreach (var fileName in GetAllTestDlls())
{
- simpleNameToPathMap.Add(Path.GetFileNameWithoutExtension(fileName), TESTASSEMBLYPATH + fileName);
+ simpleNameToPathMap.Add(Path.GetFileNameWithoutExtension(fileName), TestAssemblyPath + fileName);
}
Assembly coreAssembly = typeof(object).GetTypeInfo().Assembly;
@@ -178,9 +176,9 @@ namespace ILVerification.Tests
var resolver = new TestResolver(simpleNameToPathMap);
var typeSystemContext = new ILVerifyTypeSystemContext(resolver);
- typeSystemContext.SetSystemModule(typeSystemContext.GetModule(resolver.Resolve(coreAssembly.GetName())));
+ typeSystemContext.SetSystemModule(typeSystemContext.GetModule(resolver.Resolve(coreAssembly.GetName().Name)));
- return typeSystemContext.GetModule(resolver.Resolve(new AssemblyName(Path.GetFileNameWithoutExtension(assemblyName))));
+ return typeSystemContext.GetModule(resolver.Resolve(new AssemblyName(Path.GetFileNameWithoutExtension(assemblyName)).Name));
}
private sealed class TestResolver : ResolverBase
@@ -191,9 +189,9 @@ namespace ILVerification.Tests
_simpleNameToPathMap = simpleNameToPathMap;
}
- protected override PEReader ResolveCore(AssemblyName name)
+ protected override PEReader ResolveCore(string simpleName)
{
- if (_simpleNameToPathMap.TryGetValue(name.Name, out string path))
+ if (_simpleNameToPathMap.TryGetValue(simpleName, out string path))
{
return new PEReader(File.OpenRead(path));
}