From e6722477385c4efd997f6bf5c5832acd5ce5c606 Mon Sep 17 00:00:00 2001 From: Mike Cifelli Date: Sat, 5 May 2018 14:18:29 -0400 Subject: [PATCH] Clean up code --- src/test/kotlin/file/FilePositionTrackerTest.kt | 5 ++--- src/test/kotlin/parser/LispParserTest.kt | 13 +++---------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/test/kotlin/file/FilePositionTrackerTest.kt b/src/test/kotlin/file/FilePositionTrackerTest.kt index 358ffe0..0f77544 100644 --- a/src/test/kotlin/file/FilePositionTrackerTest.kt +++ b/src/test/kotlin/file/FilePositionTrackerTest.kt @@ -15,9 +15,8 @@ class FilePositionTrackerTest { private lateinit var trackerUnderTest: FilePositionTracker - private fun createFilePosition(lineNumber: Int, columnNumber: Int): FilePosition { - return FilePosition(FILE_NAME, lineNumber, columnNumber) - } + private fun createFilePosition(lineNumber: Int, columnNumber: Int) = + FilePosition(FILE_NAME, lineNumber, columnNumber) private fun assertTrackerPositionEquals(expectedPosition: FilePosition) { assertThat(trackerUnderTest.currentPosition()).isEqualTo(expectedPosition) diff --git a/src/test/kotlin/parser/LispParserTest.kt b/src/test/kotlin/parser/LispParserTest.kt index b0667d8..34202c8 100644 --- a/src/test/kotlin/parser/LispParserTest.kt +++ b/src/test/kotlin/parser/LispParserTest.kt @@ -27,15 +27,8 @@ import token.TokenFactory.BadCharacterException @TestInstance(PER_CLASS) class LispParserTest { - private fun createLispParser(input: String): LispParser { - val stringInputStream = createInputStreamFromString(input) - return LispParser(stringInputStream, "testFile") - } - - private fun createIOExceptionThrowingLispParser(): LispParser { - val stringInputStream = createIOExceptionThrowingInputStream() - return LispParser(stringInputStream, "testFile") - } + private fun createLispParser(input: String) = LispParser(createInputStreamFromString(input), "testFile") + private fun createIOExceptionThrowingLispParser() = LispParser(createIOExceptionThrowingInputStream(), "testFile") @Test fun `EOF check is true with no input`() { @@ -200,7 +193,7 @@ class LispParserTest { } catch (e: BadCharacterException) { val message = e.message - assertThat(message).isNotEmpty(); + assertThat(message).isNotEmpty() assertThat(e.severity).isEqualTo(ERROR) } }