npe() renamed to sure()

This commit is contained in:
Alex Tkachman
2011-11-26 10:01:57 +02:00
parent 2cbd072478
commit 554aab83be
9 changed files with 58 additions and 71 deletions
@@ -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);
}