diff --git a/src/test/kotlin/com/jetpackduba/gitnuro/ui/tree_files/TreeTest.kt b/src/test/kotlin/com/jetpackduba/gitnuro/ui/tree_files/TreeTest.kt index 5b6d737d..9f5fc281 100644 --- a/src/test/kotlin/com/jetpackduba/gitnuro/ui/tree_files/TreeTest.kt +++ b/src/test/kotlin/com/jetpackduba/gitnuro/ui/tree_files/TreeTest.kt @@ -1,5 +1,6 @@ package com.jetpackduba.gitnuro.ui.tree_files +import com.jetpackduba.gitnuro.system.systemSeparator import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test @@ -25,16 +26,20 @@ class TreeTest { @Test fun `test entriesToTreeEntry with multiple file entries`() { - val entries = listOf("dir1/file1.txt", "dir2/file2.txt", "dir3/file3.txt") + val entries = listOf( + "dir1${systemSeparator}file1.txt", + "dir2${systemSeparator}file2.txt", + "dir3${systemSeparator}file3.txt", + ) val treeContractedDirs = emptyList() val result = entriesToTreeEntry(entries, treeContractedDirs) { it } val expected = listOf( TreeItem.Dir(true, "dir1", "dir1", 0), - TreeItem.File("dir1/file1.txt", "file1.txt", "dir1/file1.txt", 1), + TreeItem.File("dir1${systemSeparator}file1.txt", "file1.txt", "dir1${systemSeparator}file1.txt", 1), TreeItem.Dir(true, "dir2", "dir2", 0), - TreeItem.File("dir2/file2.txt", "file2.txt", "dir2/file2.txt", 1), + TreeItem.File("dir2${systemSeparator}file2.txt", "file2.txt", "dir2${systemSeparator}file2.txt", 1), TreeItem.Dir(true, "dir3", "dir3", 0), - TreeItem.File("dir3/file3.txt", "file3.txt", "dir3/file3.txt", 1) + TreeItem.File("dir3${systemSeparator}file3.txt", "file3.txt", "dir3${systemSeparator}file3.txt", 1) ) assertEquals(expected, result) } @@ -42,31 +47,31 @@ class TreeTest { @Test fun `test entriesToTreeEntry with similar names`() { val entries = listOf( - "webpack/webpack.config2.ts", - "webpack/webpack.config.ts", + "webpack${systemSeparator}webpack.config2.ts", + "webpack${systemSeparator}webpack.config.ts", "webpack-plugin.ts", - "dir1/file3.txt" + "dir1${systemSeparator}file3.txt" ) val treeContractedDirs = emptyList() val result = entriesToTreeEntry(entries, treeContractedDirs) { it } val expected = listOf( TreeItem.Dir(true, "dir1", "dir1", 0), - TreeItem.File("dir1/file3.txt", "file3.txt", "dir1/file3.txt", 1), + TreeItem.File("dir1${systemSeparator}file3.txt", "file3.txt", "dir1${systemSeparator}file3.txt", 1), TreeItem.Dir(true, "webpack", "webpack", 0), - TreeItem.File("webpack/webpack.config.ts", "webpack.config.ts", "webpack/webpack.config.ts", 1), - TreeItem.File("webpack/webpack.config2.ts", "webpack.config2.ts", "webpack/webpack.config2.ts", 1), + TreeItem.File("webpack${systemSeparator}webpack.config.ts", "webpack.config.ts", "webpack${systemSeparator}webpack.config.ts", 1), + TreeItem.File("webpack${systemSeparator}webpack.config2.ts", "webpack.config2.ts", "webpack${systemSeparator}webpack.config2.ts", 1), TreeItem.File("webpack-plugin.ts", "webpack-plugin.ts", "webpack-plugin.ts", 0) ) assertEquals(expected, result) } @Test - fun `test entriesToTreeEntry with contracted directories`() { + fun `test test entriesToTreeEntry with similar names with contracted directories`() { val entries = listOf( - "webpack/webpack.config2.ts", - "webpack/webpack.config.ts", + "webpack${systemSeparator}webpack.config2.ts", + "webpack${systemSeparator}webpack.config.ts", "webpack-plugin.ts", - "dir1/file3.txt" + "dir1${systemSeparator}file3.txt" ) val treeContractedDirs = listOf("webpack", "dir1") val result = entriesToTreeEntry(entries, treeContractedDirs) { it }