mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Test functionality of Source helper class
This change introduces unit tests for Source class, which is a helper of ocloc_arg_helper. The original functionality has been improved to preserve last line even if it does not contain trailing new line sign. Moreover, empty lines are skipped since this change. Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
be50afb930
commit
41a8972772
@ -25,13 +25,19 @@ void Source::toVectorOfStrings(std::vector<std::string> &lines, bool replaceTabs
|
||||
if (replaceTabs && *file == '\t') {
|
||||
line += ' ';
|
||||
} else if (*file == '\n') {
|
||||
lines.push_back(line);
|
||||
line = "";
|
||||
if (!line.empty()) {
|
||||
lines.push_back(line);
|
||||
line = "";
|
||||
}
|
||||
} else {
|
||||
line += *file;
|
||||
}
|
||||
file++;
|
||||
}
|
||||
|
||||
if (!line.empty()) {
|
||||
lines.push_back(std::move(line));
|
||||
}
|
||||
}
|
||||
|
||||
Output::Output(const std::string &name, const void *data, const size_t &size)
|
||||
|
Reference in New Issue
Block a user