From 5717e0f32d96ec49286eb008100abca85ee06393 Mon Sep 17 00:00:00 2001 From: kenta koyama Date: Sun, 7 Aug 2022 17:11:37 +0900 Subject: [PATCH] refs #97 rename method --- .../com/github/doyaaaaaken/kotlincsv/client/CsvWriter.kt | 6 +++--- .../github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriter.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriter.kt index 97eab7b..ffddad9 100644 --- a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriter.kt +++ b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriter.kt @@ -51,7 +51,7 @@ actual class CsvWriter actual constructor( writer.use { it.write() } } - fun writeString(write: ICsvFileWriter.() -> Unit): String { + internal fun writeAsString(write: ICsvFileWriter.() -> Unit): String { val baos = ByteArrayOutputStream() open(baos, write) return String(baos.toByteArray(), Charset.forName(ctx.charset)) @@ -144,7 +144,7 @@ actual class CsvWriter actual constructor( /** * write all rows to string */ - fun writeAll(rows: List>): String { - return writeString { writeRows(rows) } + fun writeAllAsString(rows: List>): String { + return writeAsString { writeRows(rows) } } } diff --git a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt index fb70c66..2b6b3ef 100644 --- a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt @@ -91,13 +91,13 @@ class CsvWriterTest : WordSpec({ } } - "writeString method" should { + "writeAsString method" should { val row1 = listOf("a", "b", null) val row2 = listOf("d", "2", "1.0") val expected = "a,b,\r\nd,2,1.0\r\n" "write simple csv data to String" { - val actual = csvWriter().writeString { + val actual = csvWriter().writeAsString { writeRow(row1) writeRow(row2) } @@ -128,7 +128,7 @@ class CsvWriterTest : WordSpec({ } "write data to String" { - val actual = csvWriter().writeAll(rows) + val actual = csvWriter().writeAllAsString(rows) actual shouldBe expected } }