Skip to content

Commit

Permalink
refs #97 rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
doyaaaaaken committed Aug 7, 2022
1 parent dbcfd46 commit 5717e0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -144,7 +144,7 @@ actual class CsvWriter actual constructor(
/**
* write all rows to string
*/
fun writeAll(rows: List<List<Any?>>): String {
return writeString { writeRows(rows) }
fun writeAllAsString(rows: List<List<Any?>>): String {
return writeAsString { writeRows(rows) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -128,7 +128,7 @@ class CsvWriterTest : WordSpec({
}

"write data to String" {
val actual = csvWriter().writeAll(rows)
val actual = csvWriter().writeAllAsString(rows)
actual shouldBe expected
}
}
Expand Down

0 comments on commit 5717e0f

Please sign in to comment.