Skip to content

Commit

Permalink
Be consistent when checking scope
Browse files Browse the repository at this point in the history
Sometimes the scope has '.dll' at the end. Sometimes it does't. Try to
be consistent when collecting the scope.
  • Loading branch information
pearswj committed Oct 9, 2017
1 parent 5eaa706 commit 03acae5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/Compat/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -496,21 +496,22 @@ static bool CheckAbstractMethods(TypeDefinition type)
continue;

// skip if base class isn't defined in one of the reference assemblies
if (!cache.ContainsKey(@base.Scope.Name))
var scope = @base.Module.Assembly.Name; // be consistent
if (!cache.ContainsKey(scope.Name))
{
if (!quiet)
Pretty.Instruction(ResolutionStatus.Skipped, @base.Scope.Name, method.FullName);
Pretty.Instruction(ResolutionStatus.Skipped, scope.Name, method.FullName);
continue;
}

bool is_overridden = null != Utils.TryMatchMethod(type, method);

if (is_overridden)
Pretty.Instruction(ResolutionStatus.Success, @base.Module.Name, method.FullName);
Pretty.Instruction(ResolutionStatus.Success, scope.Name, method.FullName);
else
{
failure = true;
Pretty.Instruction(ResolutionStatus.Failure, @base.Module.Name, method.FullName);
Pretty.Instruction(ResolutionStatus.Failure, scope.Name, method.FullName);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion test/integration/overrides.bats
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ function setup {
echo "$output"
[ "$status" -eq 0 ]
echo "$output" | grep "Overrides (Rhino.PlugIns.RenderPlugIn)"
echo "$output" | grep "✓ Rhino.Commands.Result Rhino.PlugIns.RenderPlugIn::Render(Rhino.RhinoDoc,Rhino.Commands.RunMode,Rhino.PlugIns.RenderPlugIn/RenderOptions) < RhinoCommon.dll"
echo "$output" | grep "✓ Rhino.Commands.Result Rhino.PlugIns.RenderPlugIn::Render(Rhino.RhinoDoc,Rhino.Commands.RunMode,Rhino.PlugIns.RenderPlugIn/RenderOptions) < RhinoCommon"
}

@test "should fail if the signatures of overridden abstract methods have changed" {
run mono ../../bin/Release/Compat.exe projects/rdktest/rdktest/bin/Debug/rdktest.dll lib/rhino_en-us_6.0.16231.01091/RhinoCommon.dll
echo "$output"
[ "$status" -eq 112 ]
echo "$output" | grep "✗ Rhino.Commands.Result Rhino.PlugIns.RenderPlugIn::Render(Rhino.RhinoDoc,Rhino.Commands.RunMode,System.Boolean) < RhinoCommon"
}

@test "should not fail during overrides if class is itself abstract" {
Expand Down

0 comments on commit 03acae5

Please sign in to comment.