Skip to content

Commit

Permalink
Replacing \r\n with \n in the CSV export test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Kalinowski committed Dec 16, 2024
1 parent fc9cc42 commit 2a325f2
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.isoron.uhabits.core.io

import org.apache.commons.io.FileUtils
import org.apache.commons.io.IOUtils
import org.isoron.uhabits.core.BaseUnitTest
import org.isoron.uhabits.core.models.Habit
Expand All @@ -30,6 +29,7 @@ import java.io.IOException
import java.nio.file.Files
import java.util.*
import java.util.zip.ZipFile
import kotlin.test.assertEquals
import kotlin.test.assertTrue

class HabitsCSVExporterTest : BaseUnitTest() {
Expand Down Expand Up @@ -112,11 +112,14 @@ class HabitsCSVExporterTest : BaseUnitTest() {
file.deleteOnExit()
copyAssetToFile(assetFilename, file)

assertTrue(
FileUtils.contentEquals(
file,
File(String.format("%s/%s", baseDir.absolutePath, s))
)
)
val fileContent = normalizeLineEndings(file.readText())
val referenceFile = File(String.format("%s/%s", baseDir.absolutePath, s))
val referenceFileContent = normalizeLineEndings(referenceFile.readText())

assertEquals(fileContent, referenceFileContent)
}

private fun normalizeLineEndings(content: String): String {
return content.replace("\r\n", "\n")
}
}

0 comments on commit 2a325f2

Please sign in to comment.