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" return "$outputDirectory/$exeName"
} }
protected String removeDiagnostics(String str) {
return str.replaceAll(~/<!.*?!>(.*?)<!>/) { all, text -> text }
}
// TODO refactor // TODO refactor
List<String> buildCompileList() { List<String> buildCompileList() {
def result = [] def result = []
def filePattern = ~/(?m)\/\/\s*FILE:\s*(.*)$/ def filePattern = ~/(?m)\/\/\s*FILE:\s*(.*)$/
def srcFile = project.file(source) def srcFile = project.file(source)
def srcText = srcFile.text def srcText = removeDiagnostics(srcFile.text)
def matcher = filePattern.matcher(srcText) def matcher = filePattern.matcher(srcText)
if (!matcher.find()) { if (!matcher.find()) {
// There is only one file in the input // There is only one file in the input
project.copy{ def filePath = "$outputDirectory/${srcFile.name}"
from srcFile.absolutePath createFile(filePath, srcText)
into outputDirectory result.add(filePath)
}
def newFile ="$outputDirectory/${srcFile.name}"
result.add(newFile)
} else { } else {
// There are several files // There are several files
def processedChars = 0 def processedChars = 0