@@ -69,20 +69,35 @@ class OptionsTest {
6969 }
7070
7171 @Test
72- fun `default longTermCacheUrlPattern matches attributes path ` () {
72+ fun `default longTermCacheUrlPattern matches attributes URLs ` () {
7373 val options = Options (FakeEnv (), FakeKeychain ())
74- with (options.cache.longTermCacheUrlPattern) {
75- assertTrue(matches(" https://ge.gradle.org/api/builds/tgnsqkb2rhlni/gradle-attributes" ))
76- assertTrue(matches(" https://ge.gradle.org/api/builds/tgnsqkb2rhlni/maven-attributes" ))
77- }
74+ options.cache.longTermCacheUrlPattern.assertMatches(
75+ " https://ge.gradle.org/api/builds/tgnsqkb2rhlni/gradle-attributes" ,
76+ " https://ge.gradle.org/api/builds/tgnsqkb2rhlni/maven-attributes" ,
77+ )
78+ }
79+
80+ @Test
81+ fun `default longTermCacheUrlPattern matches build cache performance URLs` () {
82+ val options = Options (FakeEnv (), FakeKeychain ())
83+ options.cache.longTermCacheUrlPattern.assertMatches(
84+ " https://ge.gradle.org/api/builds/tgnsqkb2rhlni/gradle-build-cache-performance" ,
85+ " https://ge.gradle.org/api/builds/tgnsqkb2rhlni/maven-build-cache-performance" ,
86+ )
7887 }
7988
8089 @Test
81- fun `default shortTermCacheUrlPattern matches builds path ` () {
90+ fun `default shortTermCacheUrlPattern matches builds URLs ` () {
8291 val options = Options (FakeEnv (), FakeKeychain ())
83- with (options.cache.shortTermCacheUrlPattern) {
84- assertTrue(matches(" https://ge.gradle.org/api/builds?since=0" ))
85- assertTrue(matches(" https://ge.gradle.org/api/builds?since=0&maxBuilds=2" ))
92+ options.cache.shortTermCacheUrlPattern.assertMatches(
93+ " https://ge.gradle.org/api/builds?since=0" ,
94+ " https://ge.gradle.org/api/builds?since=0&maxBuilds=2" ,
95+ )
96+ }
97+
98+ private fun Regex.assertMatches (vararg values : String ) {
99+ values.forEach {
100+ assertTrue(matches(it), " /$pattern / doesn't match '$it '" )
86101 }
87102 }
88103}
0 commit comments