Last change
on this file since 9625c55 was
9625c55,
checked in by Jason Gross <jasongross9@gmail.com>, 7 years ago
|
Silence "Use of uninitialized value $realm in uc"
|
-
Property mode set to
100644
|
File size:
822 bytes
|
Rev | Line | |
---|
[d2ba33c] | 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 | |
---|
[9625c55] | 26 | test_casefold_principal('', ''); |
---|
| 27 | test_casefold_principal('FOO', ''); |
---|
[d2ba33c] | 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.