-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
73 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...le-plugin/src/test/groovy/org/aim42/htmlsanitycheck/gradle/HtmlSanityCheckBaseSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.aim42.htmlsanitycheck.gradle | ||
|
||
import org.junit.Rule | ||
import org.junit.rules.TemporaryFolder | ||
import spock.lang.Specification | ||
|
||
class HtmlSanityCheckBaseSpec extends Specification { | ||
final static VALID_HTML = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head></head><body></body><html>""" | ||
final static INVALID_HTML = """<body><span id="id"/><span id="id"/></body> """ | ||
|
||
@Rule | ||
TemporaryFolder testProjectDir = new TemporaryFolder() | ||
File sourceDir | ||
File buildDir | ||
File buildFile | ||
File htmlFile | ||
|
||
def setup() { | ||
buildDir = testProjectDir.newFolder("build") | ||
sourceDir = testProjectDir.newFolder("src") | ||
sourceDir.mkdirs() | ||
htmlFile = new File (sourceDir, "test.html") | ||
} | ||
|
||
protected void createBuildFile(String extendedTaskConfig = "") { | ||
// a note on writing paths to the build script on windows: | ||
// - the default file separator is a backslash | ||
// - as the path is written into a quoted string, backslashes should be quoted | ||
// - to avoid string manipulation or similar, we use URIs to avoid the problem | ||
// (URIs consist of / instead of backslashes) | ||
buildFile = testProjectDir.newFile('build.gradle') << """ | ||
plugins { | ||
id 'org.aim42.htmlSanityCheck' | ||
} | ||
htmlSanityCheck { | ||
sourceDir = file ("src") | ||
checkingResultsDir = file ("build") | ||
${extendedTaskConfig} | ||
} | ||
""".stripIndent() | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../htmlSanityCheck-core/src/test/resources |