transcendental-lisp/test/function/builtin/special/PROGNTest.java

45 lines
1.2 KiB
Java
Raw Normal View History

package function.builtin.special;
2017-11-12 09:42:25 -05:00
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TestUtilities.parseString;
import static testutil.TypeAssertions.assertNil;
import org.junit.Test;
import testutil.SymbolAndFunctionCleaner;
public class PROGNTest extends SymbolAndFunctionCleaner {
@Test
public void prognWithNoArguments() {
assertNil(evaluateString("(progn)"));
}
@Test
public void prognWithOneArgument() {
assertSExpressionsMatch(parseString("1"), evaluateString("(progn 1)"));
}
@Test
public void prognWithSeveralArguments() {
assertSExpressionsMatch(parseString("5"), evaluateString("(progn 1 2 3 4 5)"));
}
2017-03-07 13:15:40 -05:00
@Test
public void beginWithSeveralArguments() {
assertSExpressionsMatch(parseString("5"), evaluateString("(begin 1 2 3 4 5)"));
}
@Test
public void prognEvaluatesArgument() {
assertSExpressionsMatch(parseString("1"), evaluateString("(progn (car '(1 2 3)))"));
}
@Test
public void prognWithDifferentArgumentTypes() {
assertSExpressionsMatch(parseString("pear"), evaluateString("(progn t nil '(1 2) 'pear)"));
}
}