-
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using FluentAssertions; | ||
|
||
using IKVM.Tests.Util; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace IKVM.Tests.Runtime | ||
{ | ||
|
||
[TestClass] | ||
public class DefaultInterfaceMethodTests | ||
{ | ||
|
||
[TestMethod] | ||
[Ignore] | ||
public void ShouldResolveOverlappingDefaultImplementation() | ||
{ | ||
var code = @" | ||
public class TestClass { | ||
public static interface CommandInteractionPayload { | ||
int getValue(); | ||
} | ||
public static interface CommandInteraction extends CommandInteractionPayload { | ||
} | ||
public static interface CommandInteractionPayloadMixin extends CommandInteractionPayload { | ||
@Override | ||
default int getValue() { | ||
return 1; | ||
} | ||
} | ||
public static class CommandInteractionImpl implements CommandInteraction, CommandInteractionPayloadMixin { | ||
} | ||
public static interface SlashCommandInteraction extends CommandInteraction { | ||
} | ||
public static class SlashCommandInteractionImpl extends CommandInteractionImpl implements SlashCommandInteraction { | ||
} | ||
} | ||
"; | ||
var unit = new InMemoryCodeUnit("TestClass", code); | ||
var compiler = new InMemoryCompiler(new[] { unit }); | ||
compiler.Compile(); | ||
|
||
var clazz = compiler.GetClass("TestClass$SlashCommandInteractionImpl"); | ||
var ctor = clazz.getConstructor(); | ||
dynamic test = ctor.newInstance(System.Array.Empty<object>()); | ||
((int)test.getValue()).Should().Be(1); | ||
} | ||
|
||
} | ||
|
||
} |