Last change
on this file since cc27237 was
cc27237,
checked in by Jason Gross <jgross@mit.edu>, 9 years ago
|
Use g_utf8_casefold and g_utf8_normalize
We define a convenience function compat_casefold in util.c for reuse in
filters.
|
-
Property mode set to
100644
|
File size:
814 bytes
|
Rev | Line | |
---|
[cc27237] | 1 | #!/usr/bin/env perl |
---|
| 2 | use strict; |
---|
| 3 | use warnings; |
---|
| 4 | |
---|
| 5 | use Test::More qw(no_plan); |
---|
| 6 | |
---|
| 7 | use BarnOwl; |
---|
| 8 | |
---|
| 9 | # Test that casefold_principal gets it right. |
---|
| 10 | # |
---|
| 11 | # NB(jgross): I got it wrong enough times writing it that I figured |
---|
| 12 | # putting in a test case for it was worth it. |
---|
| 13 | |
---|
| 14 | sub combine_user_realm { |
---|
| 15 | my ($user, $realm) = @_; |
---|
| 16 | return $user . '@' . $realm if defined $realm and $realm ne ''; |
---|
| 17 | return $user; |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | sub test_casefold_principal { |
---|
| 21 | my ($user, $realm) = @_; |
---|
| 22 | is(BarnOwl::Message::Zephyr::casefold_principal(combine_user_realm($user, $realm)), |
---|
| 23 | combine_user_realm(lc($user), uc($realm))); |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | test_casefold_principal(''); |
---|
| 27 | test_casefold_principal('FOO'); |
---|
| 28 | test_casefold_principal('FOO', 'athena.mit.edu'); |
---|
| 29 | test_casefold_principal('FOO@BAR', 'athena.mit.edu'); |
---|
| 30 | test_casefold_principal('', 'athena.mit.edu'); |
---|
| 31 | |
---|
| 32 | 1; |
---|
| 33 | |
---|
Note: See
TracBrowser
for help on using the repository browser.