Project

General

Profile

Bug #11363 ยป 0001-Fix-tests-for-String-crypt.patch

jeremyevans0 (Jeremy Evans), 07/17/2015 09:29 PM

View differences:

test/ruby/test_m17n_comb.rb
return
end
t = str.crypt(salt)
assert_equal(b(str).crypt(b(salt)), t, "#{encdump(str)}.crypt(#{encdump(salt)})")
assert_equal(b(str).crypt(b(t)), t, "#{encdump(str)}.crypt(#{encdump(t)})")
assert_encoding('ASCII-8BIT', t.encoding)
end
test/ruby/test_string.rb
end
def test_crypt
assert_equal(S('aaGUC/JkO9/Sc'), S("mypassword").crypt(S("aa")))
assert_not_equal(S('aaGUC/JkO9/Sc'), S("mypassword").crypt(S("ab")))
assert_instance_of String, S("mypassword").crypt(S("aa"))
enc = S("mypassword").crypt(S("aa"))
assert_equal S("mypassword").crypt(S(enc)), S("mypassword").crypt(S(enc))
assert_not_equal S("mypassword").crypt(S("aa")), S("mypassword").crypt(S("ab"))
assert_not_equal S("mypassword").crypt(S("aa")), S("mypasswor").crypt(S("aa"))
assert_raise(ArgumentError) {S("mypassword").crypt(S(""))}
assert_raise(ArgumentError) {S("mypassword").crypt(S("\0a"))}
assert_raise(ArgumentError) {S("mypassword").crypt(S("a\0"))}
    (1-1/1)