npe() renamed to sure()
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package org.jetbrains.jet.runtime;
|
||||
|
||||
import jet.runtime.Intrinsics;
|
||||
import junit.framework.TestCase;
|
||||
import org.jetbrains.jet.codegen.CodegenTestCase;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@@ -9,8 +8,8 @@ import java.lang.reflect.Method;
|
||||
public class JetNpeTest extends CodegenTestCase {
|
||||
public void testStackTrace () {
|
||||
try {
|
||||
Intrinsics.npe(null);
|
||||
fail("No NPE thrown");
|
||||
Intrinsics.sure(null);
|
||||
fail("No Sure thrown");
|
||||
}
|
||||
catch (NullPointerException e) {
|
||||
StackTraceElement stackTraceElement = e.getStackTrace()[0];
|
||||
@@ -20,12 +19,13 @@ public class JetNpeTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testNotNull () throws Exception {
|
||||
loadText("fun box() = if(10.npe() == 10) \"OK\" else \"fail\"");
|
||||
loadText("fun box() = if(10.sure() == 10) \"OK\" else \"fail\"");
|
||||
blackBox();
|
||||
}
|
||||
|
||||
public void testNull () throws Exception {
|
||||
loadText("fun box() = if(null.npe() == 10) \"OK\" else \"fail\"");
|
||||
loadText("fun box() = if(null.sure() == 10) \"OK\" else \"fail\"");
|
||||
System.out.println(generateToText());
|
||||
Method box = generateFunction("box");
|
||||
assertThrows(box, NullPointerException.class, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user