30 lines
707 B
Java
30 lines
707 B
Java
package function.builtin.special;
|
|
|
|
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 ())");
|
|
}
|
|
|
|
}
|