mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[workspace model] fix behavior of ContentEntry::removeExcludePattern
GitOrigin-RevId: 35591546dca7b29fe5ddca8619ce4586b37b3262
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9440f799f4
commit
9db70bb2d4
+27
-2
@@ -73,6 +73,19 @@ class ContentEntriesInRootModelTest {
|
||||
checkContentEntryConsistency(committedEntry)
|
||||
}
|
||||
|
||||
run {
|
||||
val model = createModifiableModel(module)
|
||||
model.removeContentEntry(model.contentEntries.single())
|
||||
val committed = commitModifiableRootModel(model)
|
||||
assertThat(committed.contentEntries).isEmpty()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `add remove excluded pattern`() {
|
||||
val contentRoot = projectModel.baseProjectDir.newVirtualDirectory("content")
|
||||
ModuleRootModificationUtil.addContentRoot(module, contentRoot)
|
||||
|
||||
run {
|
||||
val model = createModifiableModel(module)
|
||||
val entry = model.contentEntries.single()
|
||||
@@ -84,12 +97,24 @@ class ContentEntriesInRootModelTest {
|
||||
assertThat(committedEntry.file).isEqualTo(contentRoot)
|
||||
assertThat(committedEntry.excludePatterns).containsExactly("*.txt")
|
||||
}
|
||||
|
||||
run {
|
||||
val model = createModifiableModel(module)
|
||||
val entry = model.contentEntries.single()
|
||||
entry.addExcludePattern("*.xml")
|
||||
entry.removeExcludePattern("*.txt")
|
||||
assertThat(entry.excludePatterns).containsExactly("*.xml")
|
||||
val committed = commitModifiableRootModel(model)
|
||||
assertThat(committed.contentEntries.single().excludePatterns).containsExactly("*.xml")
|
||||
}
|
||||
|
||||
run {
|
||||
val model = createModifiableModel(module)
|
||||
model.removeContentEntry(model.contentEntries.single())
|
||||
val entry = model.contentEntries.single()
|
||||
entry.excludePatterns = listOf("*.js", "*.ts")
|
||||
assertThat(entry.excludePatterns).containsExactly("*.js", "*.ts")
|
||||
val committed = commitModifiableRootModel(model)
|
||||
assertThat(committed.contentEntries).isEmpty()
|
||||
assertThat(committed.contentEntries.single().excludePatterns).containsExactly("*.js", "*.ts")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ internal class ModifiableContentEntryBridge(
|
||||
|
||||
override fun removeExcludePattern(pattern: String) {
|
||||
updateContentEntry {
|
||||
excludedPatterns = mutableListOf()
|
||||
excludedPatterns.remove(pattern)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user