2017-01-16 13:38:49 -05:00
|
|
|
package function.builtin.special;
|
|
|
|
|
2017-11-12 09:42:25 -05:00
|
|
|
import static testutil.TestUtilities.assertSExpressionsMatch;
|
|
|
|
import static testutil.TestUtilities.evaluateString;
|
|
|
|
import static testutil.TestUtilities.parseString;
|
2017-01-16 13:38:49 -05:00
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
2017-11-12 09:42:25 -05:00
|
|
|
import function.ArgumentValidator.TooFewArgumentsException;
|
|
|
|
import function.ArgumentValidator.TooManyArgumentsException;
|
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)");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|