Skip to content

Commit

Permalink
removed kotest from the dependencies (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Danil42Russia authored Dec 13, 2022
1 parent 96ce584 commit e95f1f8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/test/kotlin/com/vk/modulite/tests/FindCommonNamespaceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@ package com.vk.modulite.tests
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.vk.modulite.Namespace
import com.vk.modulite.services.ModuliteDependenciesCollector
import io.kotest.matchers.shouldBe

class FindCommonNamespaceTest : BasePlatformTestCase() {
fun `test find common namespace`() {
common("A", "B") shouldBe "<global namespace>"
common("A", "A") shouldBe "A"
common("A", "A\\B") shouldBe "A"
common("A\\B\\C", "A\\B\\D") shouldBe "A\\B"
common("A\\B\\C", "A\\B\\C") shouldBe "A\\B\\C"
common("A\\B\\C", "A\\B\\C\\D") shouldBe "A\\B\\C"
common("A", "B") beEqual "<global namespace>"
common("A", "A") beEqual "A"
common("A", "A\\B") beEqual "A"
common("A\\B\\C", "A\\B\\D") beEqual "A\\B"
common("A\\B\\C", "A\\B\\C") beEqual "A\\B\\C"
common("A\\B\\C", "A\\B\\C\\D") beEqual "A\\B\\C"
}

private fun common(vararg namespaces: String): String {
val nss = namespaces.toList().map { Namespace(it) }
return ModuliteDependenciesCollector.getInstance(project).findCommonNamespace(nss).toPHP()
}

private infix fun <T, U: T> T.beEqual(expect: U?) {
assertEquals(expect, this)
}
}

0 comments on commit e95f1f8

Please sign in to comment.