mirror of
https://github.com/NixOS/nix
synced 2025-07-03 06:11:46 +02:00
Fix ;
and #
bug in machine file parsing
Comments go to the end of the line, not merely the next ; *or* \n. Fix
by splitting on `;` *within* lines, and test.
(cherry picked from commit f8b13cce19
)
This commit is contained in:
parent
e191b93a0e
commit
2892b758b3
2 changed files with 31 additions and 17 deletions
|
@ -73,6 +73,18 @@ TEST(machines, getMachinesWithSemicolonSeparator) {
|
|||
EXPECT_THAT(actual, Contains(Field(&Machine::storeUri, AuthorityMatches("nix@itchy.labs.cs.uu.nl"))));
|
||||
}
|
||||
|
||||
TEST(machines, getMachinesWithCommentsAndSemicolonSeparator) {
|
||||
auto actual = Machine::parseConfig({},
|
||||
"# This is a comment ; this is still that comment\n"
|
||||
"nix@scratchy.labs.cs.uu.nl ; nix@itchy.labs.cs.uu.nl\n"
|
||||
"# This is also a comment ; this also is still that comment\n"
|
||||
"nix@scabby.labs.cs.uu.nl\n");
|
||||
EXPECT_THAT(actual, SizeIs(3));
|
||||
EXPECT_THAT(actual, Contains(Field(&Machine::storeUri, AuthorityMatches("nix@scratchy.labs.cs.uu.nl"))));
|
||||
EXPECT_THAT(actual, Contains(Field(&Machine::storeUri, AuthorityMatches("nix@itchy.labs.cs.uu.nl"))));
|
||||
EXPECT_THAT(actual, Contains(Field(&Machine::storeUri, AuthorityMatches("nix@scabby.labs.cs.uu.nl"))));
|
||||
}
|
||||
|
||||
TEST(machines, getMachinesWithCorrectCompleteSingleBuilder) {
|
||||
auto actual = Machine::parseConfig({},
|
||||
"nix@scratchy.labs.cs.uu.nl i686-linux "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue