Skip to content
Browse files

Check that a round trip works as expected.

  • Loading branch information...
1 parent d951825 commit d8ced48e0aaef7d1a4228057cfa27d22507f6601 Dave Lambley committed Dec 14, 2011
Showing with 4 additions and 0 deletions.
  1. +4 −0 t/util.t
View
4 t/util.t
@@ -7,17 +7,21 @@ use Test::More;
use Net::LDAP::Util qw/ escape_dn_value unescape_dn_value /;
is(escape_dn_value("foo"), "foo", "simple, passthrough test");
+is(unescape_dn_value(escape_dn_value("foo")), "foo", "simple, passthrough test, round trip");
is(unescape_dn_value("foo"), "foo", "simple, passthrough test, decoding");
is(escape_dn_value("foo,bar"), 'foo\,bar', "with a comma");
+is(unescape_dn_value(escape_dn_value("foo,bar")), 'foo,bar', "with a comma, round trip");
is(unescape_dn_value('foo\,bar'), 'foo,bar', "with a comma, decoding");
my $latin1 = "caf".chr(0xe9);
is(escape_dn_value($latin1), 'caf\C3\A9', 'latin1');
+is(unescape_dn_value(escape_dn_value($latin1)), $latin1, 'latin1, round trip');
is(unescape_dn_value('caf\C3\A9'), $latin1, 'latin1, decoding');
my $bad_unicode = "mieow ".chr(0x1F638);
is(escape_dn_value($bad_unicode), 'mieow \F0\9F\98\B8', 'bad unicode');
+is(unescape_dn_value(escape_dn_value($bad_unicode)), $bad_unicode, 'bad unicode, round trip');
is(unescape_dn_value('mieow \F0\9F\98\B8'), $bad_unicode, 'bad unicode, decoding');
done_testing();

0 comments on commit d8ced48

Please sign in to comment.
Something went wrong with that request. Please try again.