2017-01-14 18:01:14 -05:00
|
|
|
package function.builtin.special;
|
2016-12-25 13:29:06 -05:00
|
|
|
|
|
|
|
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 ())");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|