aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-02 12:37:16 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-02 12:37:16 +0000
commitb1ec2b007ac4beb6cf60785a951a661ff4845c9f (patch)
tree0fa8171f7ba6e89bdb0c244ea4020f68f393f28f
parent08990bc46f8f0c60ba47d612287291c16280a0f8 (diff)
downloadpaludis-b1ec2b007ac4beb6cf60785a951a661ff4845c9f.tar.gz
paludis-b1ec2b007ac4beb6cf60785a951a661ff4845c9f.tar.xz
Parse =foo/bar-scm correctly
-rw-r--r--paludis/dep_atom.cc2
-rw-r--r--paludis/dep_atom_TEST.cc12
2 files changed, 13 insertions, 1 deletions
diff --git a/paludis/dep_atom.cc b/paludis/dep_atom.cc
index 920c0f7..741885e 100644
--- a/paludis/dep_atom.cc
+++ b/paludis/dep_atom.cc
@@ -165,7 +165,7 @@ PackageDepAtom::PackageDepAtom(const std::string & ss) :
q = s.find('-', q + 1);
if ((std::string::npos == q) || (++q >= s.length()))
throw PackageDepAtomError("Couldn't parse dep atom '" + ss + "'");
- if (s.at(q) >= '0' && s.at(q) <= '9')
+ if ((s.at(q) >= '0' && s.at(q) <= '9') || (0 == s.compare(q, 3, "scm")))
break;
}
diff --git a/paludis/dep_atom_TEST.cc b/paludis/dep_atom_TEST.cc
index 109c3d4..646fe9c 100644
--- a/paludis/dep_atom_TEST.cc
+++ b/paludis/dep_atom_TEST.cc
@@ -151,6 +151,18 @@ namespace test_cases
TEST_CHECK(i.use_requirements_ptr()->state(UseFlagName("one")) == use_enabled);
TEST_CHECK(i.use_requirements_ptr()->state(UseFlagName("two")) == use_disabled);
TEST_CHECK(i.use_requirements_ptr()->state(UseFlagName("moo")) == use_unspecified);
+
+ PackageDepAtom j("=foo/bar-scm-r3");
+ TEST_CHECK_STRINGIFY_EQUAL(j.package(), "foo/bar");
+ TEST_CHECK(j.version_spec_ptr());
+ TEST_CHECK_STRINGIFY_EQUAL(*j.version_spec_ptr(), "scm-r3");
+ TEST_CHECK_EQUAL(j.version_operator(), vo_equal);
+
+ PackageDepAtom k("=foo/bar-scm");
+ TEST_CHECK_STRINGIFY_EQUAL(k.package(), "foo/bar");
+ TEST_CHECK(k.version_spec_ptr());
+ TEST_CHECK_STRINGIFY_EQUAL(*k.version_spec_ptr(), "scm");
+ TEST_CHECK_EQUAL(k.version_operator(), vo_equal);
}
} test_package_dep_atom;
}