"Fossies" - the Fresh Open Source Software Archive 
Member "gradle-8.1.1/subprojects/internal-integ-testing/src/main/groovy/org/gradle/integtests/fixtures/AbstractAutoTestedSamplesTest.groovy" (20 Apr 2023, 2134 Bytes) of package /linux/misc/gradle-8.1.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Java source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the last
Fossies "Diffs" side-by-side code changes report for "AbstractAutoTestedSamplesTest.groovy":
8.0.2_vs_8.1.0.
1 /*
2 * Copyright 2012 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.gradle.integtests.fixtures
18
19 import org.gradle.integtests.fixtures.executer.GradleContextualExecuter
20
21 class AbstractAutoTestedSamplesTest extends AbstractIntegrationTest {
22
23 def util = new AutoTestedSamplesUtil()
24
25 void runSamplesFrom(String dir) {
26 util.findSamples(dir) { file, sample, tagSuffix ->
27 println "Found sample: ${sample.split("\n")[0]} (...) in $file"
28 if (tagSuffix.contains('WithoutCC') && GradleContextualExecuter.configCache) {
29 println 'Skipping sample tagged WithoutCC'
30 return
31 }
32 def buildFile = testFile('build.gradle')
33 def settingsFile = testFile('settings.gradle')
34 def fileToTest = tagSuffix.contains('Settings') ? settingsFile : buildFile
35 if (tagSuffix.contains('WithDeprecations')) {
36 executer.noDeprecationChecks()
37 }
38 fileToTest.text = sample
39 executer
40 .withTasks('help')
41 .withArguments("--stacktrace")
42 beforeSample(file, tagSuffix)
43 executer.run()
44 fileToTest.delete()
45 }
46 }
47
48 protected void beforeSample(File file, String tagSuffix) {
49 // default is no-op
50 }
51
52 /**
53 * Useful for quick dev cycles when you need to run test against a single file.
54 *
55 * @param includes ant-like includes, e.g. '**\SomeClass.java'
56 */
57 void includeOnly(String includes) {
58 util.includes = includes
59 }
60 }