aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2023-12-22 16:35:58 +0100
committerQyriad <qyriad@qyriad.me>2024-05-02 12:02:28 -0600
commitce70f02aff058c6438119e9946122f86431151f1 (patch)
treecdd89bc83d5e11a665079e5e1c54b5efaa1ae04a /tests
parente98fc952a81f89c86e871120aac6272dccdc83b9 (diff)
getNameFromURL(): Support uppercase characters in attribute names
In particular, this makes it handle 'legacyPackages' correctly. (cherry picked from commit 936a3642264ac159f3f9093710be3465b70e0e89) Upstream-PR: https://github.com/NixOS/nix/pull/9657 Change-Id: Icc4efe02f7f8e90a2970589f72fd3d3cd4418d95
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/libutil/url-name.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/unit/libutil/url-name.cc b/tests/unit/libutil/url-name.cc
index f637efa89..164bb26d7 100644
--- a/tests/unit/libutil/url-name.cc
+++ b/tests/unit/libutil/url-name.cc
@@ -5,11 +5,13 @@ namespace nix {
/* ----------- tests for url-name.hh --------------------------------------------------*/
- TEST(getNameFromURL, getsNameFromURL) {
+ TEST(getNameFromURL, getNameFromURL) {
ASSERT_EQ(getNameFromURL(parseURL("path:/home/user/project")), "project");
ASSERT_EQ(getNameFromURL(parseURL("path:~/repos/nixpkgs#packages.x86_64-linux.hello")), "hello");
- ASSERT_EQ(getNameFromURL(parseURL("path:.#nonStandardAttr.mylaptop")), "nonStandardAttr.mylaptop");
- ASSERT_EQ(getNameFromURL(parseURL("path:./repos/myflake#nonStandardAttr.mylaptop")), "nonStandardAttr.mylaptop");
+ ASSERT_EQ(getNameFromURL(parseURL("path:~/repos/nixpkgs#legacyPackages.x86_64-linux.hello")), "hello");
+ ASSERT_EQ(getNameFromURL(parseURL("path:~/repos/nixpkgs#packages.x86_64-linux.Hello")), "Hello");
+ ASSERT_EQ(getNameFromURL(parseURL("path:.#nonStandardAttr.mylaptop")), "mylaptop");
+ ASSERT_EQ(getNameFromURL(parseURL("path:./repos/myflake#nonStandardAttr.mylaptop")), "mylaptop");
ASSERT_EQ(getNameFromURL(parseURL("path:./nixpkgs#packages.x86_64-linux.complex^bin,man")), "complex");
ASSERT_EQ(getNameFromURL(parseURL("path:./myproj#packages.x86_64-linux.default^*")), "myproj");