mirror of
https://github.com/audacity/linuxdeploy.git
synced 2026-04-12 21:25:04 -05:00
Recognize broken section headings, mk. 3
This commit is contained in:
@@ -55,6 +55,9 @@ namespace linuxdeploy {
|
||||
if (len > 0 &&
|
||||
!((len >= 2 && (line[0] == '/' && line[1] == '/')) || (len >= 1 && line[0] == '#'))) {
|
||||
if (line[0] == '[') {
|
||||
if (line.find_last_of('[') != 0)
|
||||
throw ParseError("Multiple opening [ brackets");
|
||||
|
||||
// this line apparently introduces a new section
|
||||
auto closingBracketPos = line.find(']');
|
||||
auto lastClosingBracketPos = line.find_last_of(']');
|
||||
|
||||
@@ -217,3 +217,11 @@ TEST_F(DesktopFileReaderFixture, testReadBrokenSectionHeaderTooManyClosingBracke
|
||||
|
||||
ASSERT_THROW(DesktopFileReader reader(ins), ParseError);
|
||||
}
|
||||
|
||||
TEST_F(DesktopFileReaderFixture, testReadBrokenSectionHeaderTooManyOpeningBrackets) {
|
||||
std::stringstream ins;
|
||||
ins << "[[Desktop Entry]" << std::endl
|
||||
<< "test=test" << std::endl;
|
||||
|
||||
ASSERT_THROW(DesktopFileReader reader(ins), ParseError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user