delete obsolete test (it's now fully covered by NamespaceGenTest)
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.jet.lang.psi.JetProperty;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.util.TraceMethodVisitor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class ExpressionGenTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIf() throws Exception {
|
||||
checkCode("if (false) else 20",
|
||||
"LDC false\n" +
|
||||
"INVOKESTATIC java/lang/Boolean.valueOf (Z)Ljava/lang/Boolean;\n" +
|
||||
"INVOKEVIRTUAL java/lang/Boolean.booleanValue ()Z\n" +
|
||||
"IFNE L0\n" +
|
||||
"LDC 20\n" +
|
||||
"INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer;\n" +
|
||||
"POP\n" +
|
||||
"L0");
|
||||
}
|
||||
|
||||
private void checkCode(String expr, String expectation) throws IOException {
|
||||
configureFromFileText("test.jet", "val x = " + expr);
|
||||
|
||||
JetProperty p = PsiTreeUtil.getParentOfType(getFile().findElementAt(0), JetProperty.class);
|
||||
|
||||
TraceMethodVisitor trace = new TraceMethodVisitor();
|
||||
p.getInitializer().accept(new ExpressionCodegen(trace, null, null, new FrameMap(), new JetTypeMapper(null), Type.VOID_TYPE));
|
||||
|
||||
StringWriter out = new StringWriter();
|
||||
trace.print(new PrintWriter(out));
|
||||
assertEquals(trimLines(expectation), trimLines(out.getBuffer().toString()));
|
||||
}
|
||||
|
||||
private static String trimLines(String s) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
for (String line : s.split("\\n")) {
|
||||
b.append(line.trim()).append('\n');
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user