Clean up code
This commit is contained in:
parent
9064acd7ed
commit
e672247738
|
@ -15,9 +15,8 @@ class FilePositionTrackerTest {
|
||||||
|
|
||||||
private lateinit var trackerUnderTest: FilePositionTracker
|
private lateinit var trackerUnderTest: FilePositionTracker
|
||||||
|
|
||||||
private fun createFilePosition(lineNumber: Int, columnNumber: Int): FilePosition {
|
private fun createFilePosition(lineNumber: Int, columnNumber: Int) =
|
||||||
return FilePosition(FILE_NAME, lineNumber, columnNumber)
|
FilePosition(FILE_NAME, lineNumber, columnNumber)
|
||||||
}
|
|
||||||
|
|
||||||
private fun assertTrackerPositionEquals(expectedPosition: FilePosition) {
|
private fun assertTrackerPositionEquals(expectedPosition: FilePosition) {
|
||||||
assertThat(trackerUnderTest.currentPosition()).isEqualTo(expectedPosition)
|
assertThat(trackerUnderTest.currentPosition()).isEqualTo(expectedPosition)
|
||||||
|
|
|
@ -27,15 +27,8 @@ import token.TokenFactory.BadCharacterException
|
||||||
@TestInstance(PER_CLASS)
|
@TestInstance(PER_CLASS)
|
||||||
class LispParserTest {
|
class LispParserTest {
|
||||||
|
|
||||||
private fun createLispParser(input: String): LispParser {
|
private fun createLispParser(input: String) = LispParser(createInputStreamFromString(input), "testFile")
|
||||||
val stringInputStream = createInputStreamFromString(input)
|
private fun createIOExceptionThrowingLispParser() = LispParser(createIOExceptionThrowingInputStream(), "testFile")
|
||||||
return LispParser(stringInputStream, "testFile")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createIOExceptionThrowingLispParser(): LispParser {
|
|
||||||
val stringInputStream = createIOExceptionThrowingInputStream()
|
|
||||||
return LispParser(stringInputStream, "testFile")
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `EOF check is true with no input`() {
|
fun `EOF check is true with no input`() {
|
||||||
|
@ -200,7 +193,7 @@ class LispParserTest {
|
||||||
} catch (e: BadCharacterException) {
|
} catch (e: BadCharacterException) {
|
||||||
val message = e.message
|
val message = e.message
|
||||||
|
|
||||||
assertThat(message).isNotEmpty();
|
assertThat(message).isNotEmpty()
|
||||||
assertThat(e.severity).isEqualTo(ERROR)
|
assertThat(e.severity).isEqualTo(ERROR)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue