diff --git a/src/test/kotlin/function/builtin/cons/AppendTest.java b/src/test/kotlin/function/builtin/cons/AppendTest.java deleted file mode 100644 index 5a39d28..0000000 --- a/src/test/kotlin/function/builtin/cons/AppendTest.java +++ /dev/null @@ -1,78 +0,0 @@ -package function.builtin.cons; - -import function.ArgumentValidator.BadArgumentTypeException; -import function.ArgumentValidator.DottedArgumentListException; -import function.ArgumentValidator.TooFewArgumentsException; -import function.ArgumentValidator.TooManyArgumentsException; -import org.junit.Test; -import testutil.SymbolAndFunctionCleaner; - -import static testutil.TestUtilities.assertSExpressionsMatch; -import static testutil.TestUtilities.evaluateString; -import static testutil.TestUtilities.parseString; - -public class AppendTest extends SymbolAndFunctionCleaner { - - @Test - public void appendNil() { - String input = "(append () ())"; - - assertSExpressionsMatch(parseString("nil"), evaluateString(input)); - } - - @Test - public void appendNilToList() { - String input = "(append () '(1 2 3))"; - - assertSExpressionsMatch(parseString("(1 2 3)"), evaluateString(input)); - } - - @Test - public void appendListToNil() { - String input = "(append '(1 2 3) ())"; - - assertSExpressionsMatch(parseString("(1 2 3)"), evaluateString(input)); - } - - @Test - public void appendTwoLists() { - String input = "(append '(1 2 3) '(4 5 6))"; - - assertSExpressionsMatch(parseString("(1 2 3 4 5 6)"), evaluateString(input)); - } - - @Test - public void appendMakesCopyOfFirstList() { - evaluateString("(setq x '(1 2 3))"); - evaluateString("(setq y '(4 5 6))"); - evaluateString("(append x y)"); - - assertSExpressionsMatch(parseString("(1 2 3)"), evaluateString("x")); - } - - @Test - public void appendAllowsDottedSecondList() { - String input = "(append '() (cons 3 4))"; - assertSExpressionsMatch(evaluateString("(cons 3 4)"), evaluateString(input)); - } - - @Test(expected = DottedArgumentListException.class) - public void appendWithDottedFirstList() { - evaluateString("(append (cons 1 2) '(3 4))"); - } - - @Test(expected = TooManyArgumentsException.class) - public void appendWithTooManyArguments() { - evaluateString("(append () () ())"); - } - - @Test(expected = TooFewArgumentsException.class) - public void appendWithTooFewArguments() { - evaluateString("(append ())"); - } - - @Test(expected = BadArgumentTypeException.class) - public void appendWithBadArgumentType() { - evaluateString("(append 1 '(2))"); - } -} diff --git a/src/test/kotlin/function/builtin/cons/AppendTest.kt b/src/test/kotlin/function/builtin/cons/AppendTest.kt new file mode 100644 index 0000000..0dd6beb --- /dev/null +++ b/src/test/kotlin/function/builtin/cons/AppendTest.kt @@ -0,0 +1,88 @@ +package function.builtin.cons + +import function.ArgumentValidator.BadArgumentTypeException +import function.ArgumentValidator.DottedArgumentListException +import function.ArgumentValidator.TooFewArgumentsException +import function.ArgumentValidator.TooManyArgumentsException +import org.junit.jupiter.api.Assertions.assertThrows +import org.junit.jupiter.api.Test +import testutil.LispTestInstance +import testutil.SymbolAndFunctionCleaner +import testutil.TestUtilities.assertSExpressionsMatch +import testutil.TestUtilities.evaluateString +import testutil.TestUtilities.parseString + +@LispTestInstance +class AppendTest : SymbolAndFunctionCleaner() { + + @Test + fun appendNil() { + val input = "(append () ())" + + assertSExpressionsMatch(parseString("nil"), evaluateString(input)) + } + + @Test + fun appendNilToList() { + val input = "(append () '(1 2 3))" + + assertSExpressionsMatch(parseString("(1 2 3)"), evaluateString(input)) + } + + @Test + fun appendListToNil() { + val input = "(append '(1 2 3) ())" + + assertSExpressionsMatch(parseString("(1 2 3)"), evaluateString(input)) + } + + @Test + fun appendTwoLists() { + val input = "(append '(1 2 3) '(4 5 6))" + + assertSExpressionsMatch(parseString("(1 2 3 4 5 6)"), evaluateString(input)) + } + + @Test + fun appendMakesCopyOfFirstList() { + evaluateString("(setq x '(1 2 3))") + evaluateString("(setq y '(4 5 6))") + evaluateString("(append x y)") + + assertSExpressionsMatch(parseString("(1 2 3)"), evaluateString("x")) + } + + @Test + fun appendAllowsDottedSecondList() { + val input = "(append '() (cons 3 4))" + assertSExpressionsMatch(evaluateString("(cons 3 4)"), evaluateString(input)) + } + + @Test + fun appendWithDottedFirstList() { + assertThrows(DottedArgumentListException::class.java) { + evaluateString("(append (cons 1 2) '(3 4))") + } + } + + @Test + fun appendWithTooManyArguments() { + assertThrows(TooManyArgumentsException::class.java) { + evaluateString("(append () () ())") + } + } + + @Test + fun appendWithTooFewArguments() { + assertThrows(TooFewArgumentsException::class.java) { + evaluateString("(append ())") + } + } + + @Test + fun appendWithBadArgumentType() { + assertThrows(BadArgumentTypeException::class.java) { + evaluateString("(append 1 '(2))") + } + } +} diff --git a/src/test/kotlin/function/builtin/cons/ConstructTest.java b/src/test/kotlin/function/builtin/cons/ConstructTest.java deleted file mode 100644 index 2044669..0000000 --- a/src/test/kotlin/function/builtin/cons/ConstructTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package function.builtin.cons; - -import function.ArgumentValidator.TooFewArgumentsException; -import function.ArgumentValidator.TooManyArgumentsException; -import org.junit.Test; -import sexpression.Cons; -import sexpression.Symbol; -import testutil.SymbolAndFunctionCleaner; - -import static testutil.TestUtilities.assertSExpressionsMatch; -import static testutil.TestUtilities.evaluateString; -import static testutil.TestUtilities.parseString; - -public class ConstructTest extends SymbolAndFunctionCleaner { - - @Test - public void consWithNilValues() { - String input = "(cons () nil)"; - - assertSExpressionsMatch(parseString("(())"), evaluateString(input)); - } - - @Test - public void consWithTwoSymbols() { - String input = "(cons 'a 'b)"; - - assertSExpressionsMatch(new Cons(new Symbol("A"), new Symbol("B")), evaluateString(input)); - } - - @Test - public void consWithListAsRest() { - String input = "(cons 1 '(2 3))"; - - assertSExpressionsMatch(parseString("(1 2 3)"), evaluateString(input)); - } - - @Test - public void consWithTwoLists() { - String input = "(cons '(1 2) '(3 4))"; - - assertSExpressionsMatch(parseString("((1 2) 3 4)"), evaluateString(input)); - } - - @Test - public void consWithList() { - String input = "(cons nil '(2 3))"; - - assertSExpressionsMatch(parseString("(nil 2 3)"), evaluateString(input)); - } - - @Test(expected = TooManyArgumentsException.class) - public void consWithTooManyArguments() { - evaluateString("(cons 1 2 3)"); - } - - @Test(expected = TooFewArgumentsException.class) - public void consWithTooFewArguments() { - evaluateString("(cons 1)"); - } -} diff --git a/src/test/kotlin/function/builtin/cons/ConstructTest.kt b/src/test/kotlin/function/builtin/cons/ConstructTest.kt new file mode 100644 index 0000000..26b5ed7 --- /dev/null +++ b/src/test/kotlin/function/builtin/cons/ConstructTest.kt @@ -0,0 +1,66 @@ +package function.builtin.cons + +import function.ArgumentValidator.TooFewArgumentsException +import function.ArgumentValidator.TooManyArgumentsException +import org.junit.jupiter.api.Assertions.assertThrows +import org.junit.jupiter.api.Test +import sexpression.Cons +import sexpression.Symbol +import testutil.LispTestInstance +import testutil.SymbolAndFunctionCleaner +import testutil.TestUtilities.assertSExpressionsMatch +import testutil.TestUtilities.evaluateString +import testutil.TestUtilities.parseString + +@LispTestInstance +class ConstructTest : SymbolAndFunctionCleaner() { + + @Test + fun consWithNilValues() { + val input = "(cons () nil)" + + assertSExpressionsMatch(parseString("(())"), evaluateString(input)) + } + + @Test + fun consWithTwoSymbols() { + val input = "(cons 'a 'b)" + + assertSExpressionsMatch(Cons(Symbol("A"), Symbol("B")), evaluateString(input)) + } + + @Test + fun consWithListAsRest() { + val input = "(cons 1 '(2 3))" + + assertSExpressionsMatch(parseString("(1 2 3)"), evaluateString(input)) + } + + @Test + fun consWithTwoLists() { + val input = "(cons '(1 2) '(3 4))" + + assertSExpressionsMatch(parseString("((1 2) 3 4)"), evaluateString(input)) + } + + @Test + fun consWithList() { + val input = "(cons nil '(2 3))" + + assertSExpressionsMatch(parseString("(nil 2 3)"), evaluateString(input)) + } + + @Test + fun consWithTooManyArguments() { + assertThrows(TooManyArgumentsException::class.java) { + evaluateString("(cons 1 2 3)") + } + } + + @Test + fun consWithTooFewArguments() { + assertThrows(TooFewArgumentsException::class.java) { + evaluateString("(cons 1)") + } + } +} diff --git a/src/test/kotlin/function/builtin/cons/FirstTest.java b/src/test/kotlin/function/builtin/cons/FirstTest.java deleted file mode 100644 index 21c72f1..0000000 --- a/src/test/kotlin/function/builtin/cons/FirstTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package function.builtin.cons; - -import function.ArgumentValidator.BadArgumentTypeException; -import function.ArgumentValidator.TooFewArgumentsException; -import function.ArgumentValidator.TooManyArgumentsException; -import org.junit.Test; -import testutil.SymbolAndFunctionCleaner; - -import static testutil.TestUtilities.assertSExpressionsMatch; -import static testutil.TestUtilities.evaluateString; -import static testutil.TestUtilities.parseString; - -public class FirstTest extends SymbolAndFunctionCleaner { - - @Test - public void firstOfNil() { - String input = "(first nil)"; - - assertSExpressionsMatch(parseString("()"), evaluateString(input)); - } - - @Test - public void firstOfList() { - String input = "(first '(1 2 3))"; - - assertSExpressionsMatch(parseString("1"), evaluateString(input)); - } - - @Test - public void carOfList() { - String input = "(car '(1 2 3))"; - - assertSExpressionsMatch(parseString("1"), evaluateString(input)); - } - - @Test - public void nestedFirstOfList() { - String input = "(first (first '((1 2) 3)))"; - - assertSExpressionsMatch(parseString("1"), evaluateString(input)); - } - - @Test(expected = BadArgumentTypeException.class) - public void firstOfSymbol() { - evaluateString("(first 'x)"); - } - - @Test(expected = TooManyArgumentsException.class) - public void firstWithTooManyArguments() { - evaluateString("(first '(1 2) '(1 2) \"oh\")"); - } - - @Test(expected = TooFewArgumentsException.class) - public void firstWithTooFewArguments() { - evaluateString("(first)"); - } -} diff --git a/src/test/kotlin/function/builtin/cons/FirstTest.kt b/src/test/kotlin/function/builtin/cons/FirstTest.kt new file mode 100644 index 0000000..d65352f --- /dev/null +++ b/src/test/kotlin/function/builtin/cons/FirstTest.kt @@ -0,0 +1,65 @@ +package function.builtin.cons + +import function.ArgumentValidator.BadArgumentTypeException +import function.ArgumentValidator.TooFewArgumentsException +import function.ArgumentValidator.TooManyArgumentsException +import org.junit.jupiter.api.Assertions.assertThrows +import org.junit.jupiter.api.Test +import testutil.LispTestInstance +import testutil.SymbolAndFunctionCleaner +import testutil.TestUtilities.assertSExpressionsMatch +import testutil.TestUtilities.evaluateString +import testutil.TestUtilities.parseString + +@LispTestInstance +class FirstTest : SymbolAndFunctionCleaner() { + + @Test + fun firstOfNil() { + val input = "(first nil)" + + assertSExpressionsMatch(parseString("()"), evaluateString(input)) + } + + @Test + fun firstOfList() { + val input = "(first '(1 2 3))" + + assertSExpressionsMatch(parseString("1"), evaluateString(input)) + } + + @Test + fun carOfList() { + val input = "(car '(1 2 3))" + + assertSExpressionsMatch(parseString("1"), evaluateString(input)) + } + + @Test + fun nestedFirstOfList() { + val input = "(first (first '((1 2) 3)))" + + assertSExpressionsMatch(parseString("1"), evaluateString(input)) + } + + @Test + fun firstOfSymbol() { + assertThrows(BadArgumentTypeException::class.java) { + evaluateString("(first 'x)") + } + } + + @Test + fun firstWithTooManyArguments() { + assertThrows(TooManyArgumentsException::class.java) { + evaluateString("(first '(1 2) '(1 2) \"oh\")") + } + } + + @Test + fun firstWithTooFewArguments() { + assertThrows(TooFewArgumentsException::class.java) { + evaluateString("(first)") + } + } +} diff --git a/src/test/kotlin/function/builtin/cons/LengthTest.java b/src/test/kotlin/function/builtin/cons/LengthTest.java deleted file mode 100644 index 2194975..0000000 --- a/src/test/kotlin/function/builtin/cons/LengthTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package function.builtin.cons; - -import function.ArgumentValidator.BadArgumentTypeException; -import function.ArgumentValidator.DottedArgumentListException; -import function.ArgumentValidator.TooFewArgumentsException; -import function.ArgumentValidator.TooManyArgumentsException; -import org.junit.Test; -import testutil.SymbolAndFunctionCleaner; - -import static testutil.TestUtilities.assertSExpressionsMatch; -import static testutil.TestUtilities.evaluateString; -import static testutil.TestUtilities.parseString; - -public class LengthTest extends SymbolAndFunctionCleaner { - - @Test - public void lengthOfNil() { - String input = "(length '())"; - - assertSExpressionsMatch(parseString("0"), evaluateString(input)); - } - - @Test - public void lengthOfListOfOneElement() { - String input = "(length '(1))"; - - assertSExpressionsMatch(parseString("1"), evaluateString(input)); - } - - @Test - public void lengthOfListOfManyElements() { - String input = "(length '(1 2 3 4 5))"; - - assertSExpressionsMatch(parseString("5"), evaluateString(input)); - } - - @Test(expected = BadArgumentTypeException.class) - public void lengthWithNonList() { - evaluateString("(length 'x)"); - } - - @Test(expected = TooManyArgumentsException.class) - public void lengthWithTooManyArguments() { - evaluateString("(length '(1 2) '(1 2))"); - } - - @Test(expected = TooFewArgumentsException.class) - public void lengthWithTooFewArguments() { - evaluateString("(length)"); - } - - @Test(expected = DottedArgumentListException.class) - public void lengthWithDottedList() { - evaluateString("(length (cons 1 2))"); - } -} diff --git a/src/test/kotlin/function/builtin/cons/LengthTest.kt b/src/test/kotlin/function/builtin/cons/LengthTest.kt new file mode 100644 index 0000000..401c2a4 --- /dev/null +++ b/src/test/kotlin/function/builtin/cons/LengthTest.kt @@ -0,0 +1,66 @@ +package function.builtin.cons + +import function.ArgumentValidator.BadArgumentTypeException +import function.ArgumentValidator.DottedArgumentListException +import function.ArgumentValidator.TooFewArgumentsException +import function.ArgumentValidator.TooManyArgumentsException +import org.junit.jupiter.api.Assertions.assertThrows +import org.junit.jupiter.api.Test +import testutil.LispTestInstance +import testutil.SymbolAndFunctionCleaner +import testutil.TestUtilities.assertSExpressionsMatch +import testutil.TestUtilities.evaluateString +import testutil.TestUtilities.parseString + +@LispTestInstance +class LengthTest : SymbolAndFunctionCleaner() { + + @Test + fun lengthOfNil() { + val input = "(length '())" + + assertSExpressionsMatch(parseString("0"), evaluateString(input)) + } + + @Test + fun lengthOfListOfOneElement() { + val input = "(length '(1))" + + assertSExpressionsMatch(parseString("1"), evaluateString(input)) + } + + @Test + fun lengthOfListOfManyElements() { + val input = "(length '(1 2 3 4 5))" + + assertSExpressionsMatch(parseString("5"), evaluateString(input)) + } + + @Test + fun lengthWithNonList() { + assertThrows(BadArgumentTypeException::class.java) { + evaluateString("(length 'x)") + } + } + + @Test + fun lengthWithTooManyArguments() { + assertThrows(TooManyArgumentsException::class.java) { + evaluateString("(length '(1 2) '(1 2))") + } + } + + @Test + fun lengthWithTooFewArguments() { + assertThrows(TooFewArgumentsException::class.java) { + evaluateString("(length)") + } + } + + @Test + fun lengthWithDottedList() { + assertThrows(DottedArgumentListException::class.java) { + evaluateString("(length (cons 1 2))") + } + } +} diff --git a/src/test/kotlin/function/builtin/cons/ListTest.java b/src/test/kotlin/function/builtin/cons/ListTest.java deleted file mode 100644 index 6dccf3b..0000000 --- a/src/test/kotlin/function/builtin/cons/ListTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package function.builtin.cons; - -import org.junit.Test; -import testutil.SymbolAndFunctionCleaner; - -import static function.builtin.cons.List.makeList; -import static testutil.TestUtilities.assertSExpressionsMatch; -import static testutil.TestUtilities.evaluateString; -import static testutil.TestUtilities.parseString; - -public class ListTest extends SymbolAndFunctionCleaner { - - @Test - public void listWithNoArguments() { - String input = "(list)"; - - assertSExpressionsMatch(parseString("nil"), evaluateString(input)); - } - - @Test - public void listWithOneArgument() { - String input = "(list 1)"; - - assertSExpressionsMatch(parseString("(1)"), evaluateString(input)); - } - - @Test - public void listWithTwoArguments() { - String input = "(list 2 3)"; - - assertSExpressionsMatch(parseString("(2 3)"), evaluateString(input)); - } - - @Test - public void listWithManyArguments() { - String input = "(list 'm 'a 'n 'y 'a 'r 'g 's)"; - - assertSExpressionsMatch(parseString("(m a n y a r g s)"), evaluateString(input)); - } - - @Test - public void listWithOneListArgument() { - String input = "(list '(1))"; - - assertSExpressionsMatch(parseString("((1))"), evaluateString(input)); - } - - @Test - public void listWithManyListArguments() { - String input = "(list '(1) '(2 3) ())"; - - assertSExpressionsMatch(parseString("((1) (2 3) ())"), evaluateString(input)); - } - - @Test - public void staticMakeList() { - assertSExpressionsMatch(parseString("(22)"), makeList(parseString("22"))); - } -} diff --git a/src/test/kotlin/function/builtin/cons/ListTest.kt b/src/test/kotlin/function/builtin/cons/ListTest.kt new file mode 100644 index 0000000..05aca8e --- /dev/null +++ b/src/test/kotlin/function/builtin/cons/ListTest.kt @@ -0,0 +1,60 @@ +package function.builtin.cons + +import function.builtin.cons.List.Companion.makeList +import org.junit.jupiter.api.Test +import testutil.LispTestInstance +import testutil.SymbolAndFunctionCleaner +import testutil.TestUtilities.assertSExpressionsMatch +import testutil.TestUtilities.evaluateString +import testutil.TestUtilities.parseString + +@LispTestInstance +class ListTest : SymbolAndFunctionCleaner() { + + @Test + fun listWithNoArguments() { + val input = "(list)" + + assertSExpressionsMatch(parseString("nil"), evaluateString(input)) + } + + @Test + fun listWithOneArgument() { + val input = "(list 1)" + + assertSExpressionsMatch(parseString("(1)"), evaluateString(input)) + } + + @Test + fun listWithTwoArguments() { + val input = "(list 2 3)" + + assertSExpressionsMatch(parseString("(2 3)"), evaluateString(input)) + } + + @Test + fun listWithManyArguments() { + val input = "(list 'm 'a 'n 'y 'a 'r 'g 's)" + + assertSExpressionsMatch(parseString("(m a n y a r g s)"), evaluateString(input)) + } + + @Test + fun listWithOneListArgument() { + val input = "(list '(1))" + + assertSExpressionsMatch(parseString("((1))"), evaluateString(input)) + } + + @Test + fun listWithManyListArguments() { + val input = "(list '(1) '(2 3) ())" + + assertSExpressionsMatch(parseString("((1) (2 3) ())"), evaluateString(input)) + } + + @Test + fun staticMakeList() { + assertSExpressionsMatch(parseString("(22)"), makeList(parseString("22"))) + } +} diff --git a/src/test/kotlin/function/builtin/cons/RestTest.java b/src/test/kotlin/function/builtin/cons/RestTest.java deleted file mode 100644 index eb21906..0000000 --- a/src/test/kotlin/function/builtin/cons/RestTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package function.builtin.cons; - -import function.ArgumentValidator.BadArgumentTypeException; -import function.ArgumentValidator.TooFewArgumentsException; -import function.ArgumentValidator.TooManyArgumentsException; -import org.junit.Test; -import testutil.SymbolAndFunctionCleaner; - -import static testutil.TestUtilities.assertSExpressionsMatch; -import static testutil.TestUtilities.evaluateString; -import static testutil.TestUtilities.parseString; - -public class RestTest extends SymbolAndFunctionCleaner { - - @Test - public void restOfNil() { - String input = "(rest nil)"; - - assertSExpressionsMatch(parseString("()"), evaluateString(input)); - } - - @Test - public void restOfList() { - String input = "(rest '(1 2 3))"; - - assertSExpressionsMatch(parseString("(2 3)"), evaluateString(input)); - } - - @Test - public void cdrOfList() { - String input = "(cdr '(1 2 3))"; - - assertSExpressionsMatch(parseString("(2 3)"), evaluateString(input)); - } - - @Test - public void nestedRestOfList() { - String input = "(rest (rest '(1 2 3)))"; - - assertSExpressionsMatch(parseString("(3)"), evaluateString(input)); - } - - @Test(expected = BadArgumentTypeException.class) - public void restOfSymbol() { - evaluateString("(rest 'x)"); - } - - @Test(expected = TooManyArgumentsException.class) - public void restWithTooManyArguments() { - evaluateString("(rest '(1 2) '(1 2) \"oh\")"); - } - - @Test(expected = TooFewArgumentsException.class) - public void restWithTooFewArguments() { - evaluateString("(rest)"); - } -} diff --git a/src/test/kotlin/function/builtin/cons/RestTest.kt b/src/test/kotlin/function/builtin/cons/RestTest.kt new file mode 100644 index 0000000..6272346 --- /dev/null +++ b/src/test/kotlin/function/builtin/cons/RestTest.kt @@ -0,0 +1,65 @@ +package function.builtin.cons + +import function.ArgumentValidator.BadArgumentTypeException +import function.ArgumentValidator.TooFewArgumentsException +import function.ArgumentValidator.TooManyArgumentsException +import org.junit.jupiter.api.Assertions.assertThrows +import org.junit.jupiter.api.Test +import testutil.LispTestInstance +import testutil.SymbolAndFunctionCleaner +import testutil.TestUtilities.assertSExpressionsMatch +import testutil.TestUtilities.evaluateString +import testutil.TestUtilities.parseString + +@LispTestInstance +class RestTest : SymbolAndFunctionCleaner() { + + @Test + fun restOfNil() { + val input = "(rest nil)" + + assertSExpressionsMatch(parseString("()"), evaluateString(input)) + } + + @Test + fun restOfList() { + val input = "(rest '(1 2 3))" + + assertSExpressionsMatch(parseString("(2 3)"), evaluateString(input)) + } + + @Test + fun cdrOfList() { + val input = "(cdr '(1 2 3))" + + assertSExpressionsMatch(parseString("(2 3)"), evaluateString(input)) + } + + @Test + fun nestedRestOfList() { + val input = "(rest (rest '(1 2 3)))" + + assertSExpressionsMatch(parseString("(3)"), evaluateString(input)) + } + + @Test + fun restOfSymbol() { + assertThrows(BadArgumentTypeException::class.java) { + evaluateString("(rest 'x)") + } + } + + @Test + fun restWithTooManyArguments() { + assertThrows(TooManyArgumentsException::class.java) { + evaluateString("(rest '(1 2) '(1 2) \"oh\")") + } + } + + @Test + fun restWithTooFewArguments() { + assertThrows(TooFewArgumentsException::class.java) { + evaluateString("(rest)") + } + } +}