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

41 lines
1022 B
Java
Raw Normal View History

package function.builtin.predicate;
2017-01-27 11:37:11 -05:00
import static testutil.TestUtilities.evaluateString;
2017-11-12 09:42:25 -05:00
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
import org.junit.Test;
2017-11-12 09:42:25 -05:00
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import testutil.SymbolAndFunctionCleaner;
public class NULLTest extends SymbolAndFunctionCleaner {
@Test
2017-01-27 11:37:11 -05:00
public void nilIsNull() {
assertT(evaluateString("(null ())"));
}
2017-03-07 13:15:40 -05:00
@Test
public void nilIsNullWithAlias() {
assertT(evaluateString("(null? ())"));
}
@Test
2017-01-27 11:37:11 -05:00
public void listIsNotNull() {
assertNil(evaluateString("(null '(1))"));
}
@Test(expected = TooFewArgumentsException.class)
public void testNullWithTooFewArguments() {
evaluateString("(null)");
}
@Test(expected = TooManyArgumentsException.class)
public void testNullWithTooManyArguments() {
evaluateString("(null 1 2)");
}
}