transcendental-lisp/test/function/builtin/predicate/LISTPTest.java

41 lines
1.0 KiB
Java

package function.builtin.predicate;
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
import org.junit.Test;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import testutil.SymbolAndFunctionCleaner;
public class LISTPTest extends SymbolAndFunctionCleaner {
@Test
public void listpWithList() {
assertT(evaluateString("(listp '(1))"));
}
@Test
public void listpWithListAndAlias() {
assertT(evaluateString("(list? '(1))"));
}
@Test
public void listpWithNonList() {
assertNil(evaluateString("(listp 1)"));
}
@Test(expected = TooFewArgumentsException.class)
public void listpWithTooFewArguments() {
evaluateString("(listp)");
}
@Test(expected = TooManyArgumentsException.class)
public void listpWithTooManyArguments() {
evaluateString("(listp '() '())");
}
}