mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
testdata for IDEA-140686
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package nise;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
|
||||
class TypeTest {
|
||||
public static void main(String[] args) {
|
||||
assertThat(id(new Combiner<>(echo("A"), echo("B"), (str1, str2) ->
|
||||
new StringBuilder(str1.length() + str2.length())
|
||||
.append(str1)
|
||||
.append(str2))).get(),
|
||||
hasSameContentAs("AB"));
|
||||
}
|
||||
|
||||
private static <R> Supplier<R> id(Supplier<R> s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
private static <T> Supplier<T> echo(T s) {
|
||||
return () -> s;
|
||||
}
|
||||
|
||||
private static Predicate<CharSequence> hasSameContentAs(CharSequence seq) {
|
||||
return charSequence -> charSequence.toString().equals(seq.toString());
|
||||
}
|
||||
|
||||
private static <T> void assertThat(T actual, Predicate<? super T> matcher) {
|
||||
if (!matcher.test(actual)) throw new AssertionError();
|
||||
}
|
||||
|
||||
private static class Combiner<T1, T2, R> implements Supplier<R> {
|
||||
private final Supplier<T1> s1;
|
||||
private final Supplier<T2> s2;
|
||||
private final BiFunction<T1, T2, R> f;
|
||||
|
||||
public Combiner(Supplier<T1> s1, Supplier<T2> s2, BiFunction<T1, T2, R> f) {
|
||||
this.s1 = s1;
|
||||
this.s2 = s2;
|
||||
this.f = f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R get() {
|
||||
return f.apply(s1.get(), s2.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,10 @@ public class Diamond8HighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testWithConstructorRefInside() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIDEA140686() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
|
||||
|
||||
Reference in New Issue
Block a user