File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
tests/konsist/src/test/kotlin/io/element/android/tests/konsist Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -68,4 +68,30 @@ class KonsistLicenseTest {
68
68
enterpriseLicense.containsMatchIn(it.text)
69
69
}
70
70
}
71
+
72
+ @Test
73
+ fun `assert that files do not have double license header` () {
74
+ Konsist
75
+ .scopeFromProject()
76
+ .files
77
+ .filter {
78
+ it.nameWithExtension != " locales.kt" &&
79
+ it.nameWithExtension != " KonsistLicenseTest.kt" &&
80
+ it.name.startsWith(" Template " ).not ()
81
+ }
82
+ .assertTrue { it ->
83
+ it.text.count(" New Vector" ) == 1
84
+ }
85
+ }
86
+ }
87
+
88
+ private fun String.count (subString : String ): Int {
89
+ var count = 0
90
+ var index = 0
91
+ while (true ) {
92
+ index = indexOf(subString, index)
93
+ if (index == - 1 ) return count
94
+ count++
95
+ index + = subString.length
96
+ }
71
97
}
You can’t perform that action at this time.
0 commit comments