tests: Ignore diagnostics directives

This commit is contained in:
Ilya Matveev
2017-03-02 18:09:11 +03:00
committed by ilmat192
parent c7e4f0f28f
commit 126d6f3d41
@@ -83,22 +83,23 @@ abstract class KonanTest extends DefaultTask {
return "$outputDirectory/$exeName"
}
protected String removeDiagnostics(String str) {
return str.replaceAll(~/<!.*?!>(.*?)<!>/) { all, text -> text }
}
// TODO refactor
List<String> buildCompileList() {
def result = []
def filePattern = ~/(?m)\/\/\s*FILE:\s*(.*)$/
def srcFile = project.file(source)
def srcText = srcFile.text
def srcText = removeDiagnostics(srcFile.text)
def matcher = filePattern.matcher(srcText)
if (!matcher.find()) {
// There is only one file in the input
project.copy{
from srcFile.absolutePath
into outputDirectory
}
def newFile ="$outputDirectory/${srcFile.name}"
result.add(newFile)
def filePath = "$outputDirectory/${srcFile.name}"
createFile(filePath, srcText)
result.add(filePath)
} else {
// There are several files
def processedChars = 0