Exclude common file asserts.kt from tests using StdLib, as its methods conflict with kotlin.test.* methods.
This commit is contained in:
@@ -59,7 +59,7 @@ public abstract class JsUnitTestBase extends MultipleFilesTranslationTest {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
protected List<String> additionalKotlinFiles() {
|
protected List<String> additionalKotlinFiles() {
|
||||||
List<String> result = Lists.newArrayList(super.additionalKotlinFiles());
|
List<String> result = StdLibTestBase.removeAdHocAssertions(super.additionalKotlinFiles());
|
||||||
result.add(JS_TESTS_KT);
|
result.add(JS_TESTS_KT);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.js.test.SingleFileTranslationTest;
|
|||||||
import org.jetbrains.kotlin.js.test.rhino.RhinoResultChecker;
|
import org.jetbrains.kotlin.js.test.rhino.RhinoResultChecker;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// TODO: should be dropped with derived classes?
|
// TODO: should be dropped with derived classes?
|
||||||
@@ -62,4 +63,22 @@ abstract class StdLibTestBase extends SingleFileTranslationTest {
|
|||||||
}
|
}
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
protected List<String> additionalKotlinFiles() {
|
||||||
|
return removeAdHocAssertions(super.additionalKotlinFiles());
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static List<String> removeAdHocAssertions(List<String> additionalKotlinFiles) {
|
||||||
|
List<String> kotlinFiles = Lists.newArrayList(additionalKotlinFiles);
|
||||||
|
Iterator<String> iterator = kotlinFiles.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
if (new File(iterator.next()).getName().equals("asserts.kt"))
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
return kotlinFiles;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
package kotlin
|
package kotlin
|
||||||
|
// This file should be excluded from tests using StdLib, as these methods conflict with corresponding methods from kotlin.test
|
||||||
|
// see StdLibTestBase.removeAdHocAssertions
|
||||||
|
|
||||||
fun fail(message: String? = null) = throw Exception(message)
|
fun fail(message: String? = null) = throw Exception(message)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user