File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
commonMain/kotlin/com/diffplug/selfie
commonTest/kotlin/com/diffplug/selfie Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ class StringSelfie(
212212 * Returns a serialized form of only the given facets if they are available, silently omits missing
213213 * facets.
214214 */
215- private fun serializeOnlyFacets (snapshot : Snapshot , keys : Collection <String >): String {
215+ internal fun serializeOnlyFacets (snapshot : Snapshot , keys : Collection <String >): String {
216216 val writer = StringBuilder ()
217217 for (key in keys) {
218218 if (key.isEmpty()) {
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (C) 2025 DiffPlug
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package com.diffplug.selfie
17+
18+ import io.kotest.assertions.throwables.shouldThrow
19+ import io.kotest.matchers.shouldBe
20+ import kotlin.test.Test
21+
22+ class SelfieImplementationsTest {
23+ @Test
24+ fun issue_529 () {
25+ val empty = Snapshot .of(" " )
26+ val emptyPlusFacet = Snapshot .of(" " ).plusFacet(" new-facet" , " new-facet-value" )
27+ val exception =
28+ shouldThrow<StringIndexOutOfBoundsException > {
29+ serializeOnlyFacets(empty, listOf (" new-facet" ))
30+ }
31+ exception.message shouldBe " String index out of range: -1"
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments