Browse Source
Merge pull request #1151 from kephir4eg/master
Fix config file parsing
pull/1153/head
trapexit
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
8 additions and
2 deletions
-
src/branches.cpp
-
tests/tests.cpp
|
@ -80,10 +80,13 @@ namespace l |
|
|
uint64_t offset; |
|
|
uint64_t offset; |
|
|
|
|
|
|
|
|
offset = s_.find_first_not_of("+<>-="); |
|
|
offset = s_.find_first_not_of("+<>-="); |
|
|
|
|
|
if (offset == std::string::npos) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(offset > 1) |
|
|
if(offset > 1) |
|
|
offset = 2; |
|
|
offset = 2; |
|
|
*instr_ = s_.substr(0,offset); |
|
|
*instr_ = s_.substr(0,offset); |
|
|
if(offset != std::string::npos) |
|
|
|
|
|
*values_ = s_.substr(offset); |
|
|
*values_ = s_.substr(offset); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
@ -86,6 +86,9 @@ test_config_branches() |
|
|
TEST_CHECK(b->minfreespace() == 1234); |
|
|
TEST_CHECK(b->minfreespace() == 1234); |
|
|
TEST_CHECK(b.to_string() == ""); |
|
|
TEST_CHECK(b.to_string() == ""); |
|
|
|
|
|
|
|
|
|
|
|
// Parse initial value for branch
|
|
|
|
|
|
TEST_CHECK(b.from_string(b.to_string()) == 0); |
|
|
|
|
|
|
|
|
bcp0 = b; |
|
|
bcp0 = b; |
|
|
TEST_CHECK(b.from_string("/foo/bar") == 0); |
|
|
TEST_CHECK(b.from_string("/foo/bar") == 0); |
|
|
TEST_CHECK(b.to_string() == "/foo/bar=RW"); |
|
|
TEST_CHECK(b.to_string() == "/foo/bar=RW"); |
|
|