source: t/BarnOwl_Message_Zephyr.t @ 9625c55

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
Line 
1#!/usr/bin/env perl
2use strict;
3use warnings;
4
5use Test::More qw(no_plan);
6
7use 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
14sub combine_user_realm {
15    my ($user, $realm) = @_;
16    return $user . '@' . $realm if defined $realm and $realm ne '';
17    return $user;
18}
19
20sub 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
26test_casefold_principal('', '');
27test_casefold_principal('FOO', '');
28test_casefold_principal('FOO', 'athena.mit.edu');
29test_casefold_principal('FOO@BAR', 'athena.mit.edu');
30test_casefold_principal('', 'athena.mit.edu');
31
321;
33
Note: See TracBrowser for help on using the repository browser.