transcendental-lisp/test/function/builtin/DEFUNTester.java

30 lines
699 B
Java
Raw Normal View History

package function.builtin;
import static testutil.TestUtilities.*;
import org.junit.Test;
import function.ArgumentValidator.*;
public class DEFUNTester {
@Test
public void testDefun() {
String input = "(defun f () nil)";
assertSExpressionsMatch(evaluateString(input), parseString("f"));
assertSExpressionsMatch(evaluateString("(f)"), parseString("()"));
}
@Test(expected = BadArgumentTypeException.class)
public void testDefunWithNonSymbolName() {
evaluateString("(defun 1 () ())");
}
@Test(expected = TooFewArgumentsException.class)
public void testApplyWithTooFewArguments() {
evaluateString("(defun 1 ())");
}
}