From 37211ec1459226e53a73883c8e82fb2d34beabda Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Tue, 16 Oct 2018 20:23:18 +0300 Subject: [PATCH] [git] add test for trailing spaces in file names follow-up: 8ab9a49d8e555a7e7441d83fbf3e2cfc57c2b9b7 IDEA-193814, IDEA-199761 --- .../tests/git4idea/history/GitLogParserTest.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/git4idea/tests/git4idea/history/GitLogParserTest.kt b/plugins/git4idea/tests/git4idea/history/GitLogParserTest.kt index 6153842ee146..f8cb495f85ef 100644 --- a/plugins/git4idea/tests/git4idea/history/GitLogParserTest.kt +++ b/plugins/git4idea/tests/git4idea/history/GitLogParserTest.kt @@ -81,6 +81,14 @@ class GitLogParserTest : GitPlatformTest() { doTestAllRecords(STATUS, true) } + @Throws(VcsException::class) + fun test_files_with_spaces() { + val parser = GitLogParser(myProject, STATUS, *GIT_LOG_OPTIONS) + val expectedRecord = createTestRecord(changes = listOf(modified("file "), modified(" "))) + val actualRecord = parser.parseOneRecord(expectedRecord.prepareOutputLine(STATUS))!! + assertRecord(actualRecord, expectedRecord, STATUS) + } + @Throws(VcsException::class) private fun doTestAllRecords(nameStatusOption: NameStatus, newRefsFormat: Boolean = false) { val expectedRecords = generateRecords(newRefsFormat) @@ -329,7 +337,9 @@ private val GIT_LOG_OPTIONS = arrayOf(HASH, COMMIT_TIME, AUTHOR_NAME, AUTHOR_TIM private fun createTestRecord(vararg parameters: Pair, changes: List = emptyList(), newRefsFormat: Boolean = false): GitTestLogRecord { - val data = mutableMapOf(Pair(AUTHOR_TIME, Date(1317027817L * 1000)), + val data = mutableMapOf(Pair(SUBJECT, "Subject"), + Pair(BODY, "Body"), + Pair(AUTHOR_TIME, Date(1317027817L * 1000)), Pair(AUTHOR_NAME, "John Doe"), Pair(AUTHOR_EMAIL, "John.Doe@example.com"), Pair(COMMIT_TIME, Date(1315471452L * 1000)),