mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
svn: Fix parsing empty "svn:mergeinfo" value
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.svn.mergeinfo
|
||||
|
||||
import org.jetbrains.idea.svn.api.ErrorCode.MERGE_INFO_PARSE_ERROR
|
||||
@@ -8,7 +8,8 @@ data class MergeRangeList(val ranges: Set<MergeRange>) {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@Throws(SvnBindException::class)
|
||||
fun parseMergeInfo(value: String): Map<String, MergeRangeList> = value.lineSequence().map { parseLine(it) }.toMap()
|
||||
fun parseMergeInfo(value: String): Map<String, MergeRangeList> = if (value.isEmpty()) emptyMap()
|
||||
else value.lineSequence().map { parseLine(it) }.toMap()
|
||||
|
||||
@Throws(SvnBindException::class)
|
||||
fun parseRange(value: String): MergeRange {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.svn.mergeinfo
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class MergeRangeListTest {
|
||||
@@ -27,6 +28,12 @@ class MergeRangeListTest {
|
||||
assertEquals(expected, mergeInfo)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `parse empty merge info`() {
|
||||
val mergeInfo = MergeRangeList.parseMergeInfo("")
|
||||
assertTrue(mergeInfo.isEmpty())
|
||||
}
|
||||
|
||||
private fun assertRange(value: String, start: Long, endInclusive: Long, isInheritable: Boolean = true) = assertEquals(
|
||||
MergeRange(start, endInclusive, isInheritable), MergeRangeList.parseRange(value))
|
||||
}
|
||||
Reference in New Issue
Block a user