Add test for input errors

This commit is contained in:
Mike Cifelli 2018-08-10 17:46:26 -04:00
parent eaf80390be
commit c2c53e0d0f
2 changed files with 17 additions and 14 deletions

View File

@ -1,24 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="transcendental-lisp" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<extension name="coverage" sample_coverage="false" />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://%MODULE_WORKING_DIR%" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
<dir value="$PROJECT_DIR$/src/test/java" />
<patterns />
<method />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -140,7 +140,18 @@ class LispInterpreterTest {
}
@Test
fun interpreterHandlesError() {
fun interpreterHandlesInputError() {
setCommonFeatures()
LispInterpreterBuilder.setNotInteractive()
LispInterpreterBuilder.setInput(createInputStreamFromString("['pickle"), "input")
LispInterpreterBuilder.build().interpret()
assertEquals("PICKLE\n\n", outputStream.toString())
assertEquals("[error] illegal character >>[<< - line 1, column 1\n", errorOutputStream.toString())
}
@Test
fun interpreterHandlesEvaluationError() {
setCommonFeatures()
LispInterpreterBuilder.setNotInteractive()
LispInterpreterBuilder.setInput(createInputStreamFromString("pickle"), "input")