1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 14:21:48 +02:00

isValidSchemeName: Use regex

As requested by Eelco Dolstra. I think it used to be simpler.

(cherry picked from commit 4eaeda6604)
This commit is contained in:
Robert Hensing 2023-12-12 17:43:54 +01:00
parent 598b0e2317
commit ebdb6926fd
2 changed files with 8 additions and 12 deletions

View file

@ -360,6 +360,11 @@ TEST(nix, isValidSchemeName) {
ASSERT_FALSE(isValidSchemeName(".file"));
ASSERT_FALSE(isValidSchemeName("-file"));
ASSERT_FALSE(isValidSchemeName("1file"));
// regex ok?
ASSERT_FALSE(isValidSchemeName("\nhttp"));
ASSERT_FALSE(isValidSchemeName("\nhttp\n"));
ASSERT_FALSE(isValidSchemeName("http\n"));
ASSERT_FALSE(isValidSchemeName("http "));
}
}