Add breaking tests.

This commit is contained in:
Jamstah 2011-01-11 14:23:15 +00:00
parent 5bc73d3aa3
commit ab196040b4
2 changed files with 10 additions and 3 deletions

View file

@ -76,8 +76,8 @@ describe Net::LDAP::Filter do
end
end
describe "<- .escape(str)" do
it "should escape !, &, *, :, | and ~" do
Net::LDAP::Filter.escape('!&*:|~').should == "\\21\\26\\2A\\3A\\7C\\7E"
it "should escape nul, *, (, ) and \\" do
Net::LDAP::Filter.escape("\0*()\\").should == "\\00\\2A\\28\\29\\5C"
end
end
end
end

View file

@ -24,6 +24,13 @@ class TestFilter < Test::Unit::TestCase
assert_equal("(uid=george *)", Filter.eq("uid", "george *").to_s)
end
def test_convenience_filters
assert_equal("(uid=\\2A)", Filter.equals("uid", "*").to_s)
assert_equal("(uid=\\28*)", Filter.begins("uid", "(").to_s)
assert_equal("(uid=*\\29)", Filter.ends("uid", ")").to_s)
assert_equal("(uid=*\\5C*)", Filter.contains("uid", "\\").to_s)
end
def test_c2
assert_equal("(uid=george *)",
Filter.from_rfc2254("uid=george *").to_rfc2254)