2017-01-16 13:38:49 -05:00
|
|
|
package function.builtin.special;
|
|
|
|
|
|
|
|
import static testutil.TestUtilities.*;
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
import function.ArgumentValidator.*;
|
2017-07-19 15:23:15 -04:00
|
|
|
import testutil.SymbolAndFunctionCleaner;
|
2017-01-16 13:38:49 -05:00
|
|
|
|
2017-07-19 15:23:15 -04:00
|
|
|
public class QUOTETest extends SymbolAndFunctionCleaner {
|
2017-01-16 13:38:49 -05:00
|
|
|
|
|
|
|
@Test
|
2017-02-28 15:01:05 -05:00
|
|
|
public void quoteSymbol() {
|
2017-01-16 13:38:49 -05:00
|
|
|
String input = "'a";
|
|
|
|
|
2017-01-27 10:51:25 -05:00
|
|
|
assertSExpressionsMatch(parseString("a"), evaluateString(input));
|
2017-01-16 13:38:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2017-02-28 15:01:05 -05:00
|
|
|
public void quoteList() {
|
2017-01-16 13:38:49 -05:00
|
|
|
String input = "'(l i s t)";
|
|
|
|
|
2017-01-27 10:51:25 -05:00
|
|
|
assertSExpressionsMatch(parseString("(l i s t)"), evaluateString(input));
|
2017-01-16 13:38:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test(expected = TooFewArgumentsException.class)
|
2017-02-28 15:01:05 -05:00
|
|
|
public void quoteWithTooFewArguments() {
|
2017-01-16 13:38:49 -05:00
|
|
|
evaluateString("(quote)");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test(expected = TooManyArgumentsException.class)
|
2017-02-28 15:01:05 -05:00
|
|
|
public void quoteWithTooManyArguments() {
|
2017-01-16 13:38:49 -05:00
|
|
|
evaluateString("(quote a b)");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|