Lines 18-28
Link Here
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::NoWarnings; |
20 |
use Test::NoWarnings; |
21 |
use Test::More tests => 11; |
21 |
use Test::More tests => 12; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
24 |
BEGIN { |
24 |
BEGIN { |
25 |
use_ok( 'C4::SIP::Sip', qw( timestamp ) ); |
25 |
use_ok( 'C4::SIP::Sip', qw( timestamp add_field ) ); |
26 |
} |
26 |
} |
27 |
|
27 |
|
28 |
my $date_time = C4::SIP::Sip::timestamp(); |
28 |
my $date_time = C4::SIP::Sip::timestamp(); |
Lines 114-116
subtest 'remove_password_from_message' => sub {
Link Here
|
114 |
"11 Checkout - empty AC and AND" |
114 |
"11 Checkout - empty AC and AND" |
115 |
); |
115 |
); |
116 |
}; |
116 |
}; |
117 |
- |
117 |
|
|
|
118 |
subtest 'add_field line ending normalization' => sub { |
119 |
plan tests => 6; |
120 |
|
121 |
# Test Unix line endings (\n) |
122 |
my $field_unix = C4::SIP::Sip::add_field( "AF", "Line one\nLine two\nLine three" ); |
123 |
is( $field_unix, "AFLine one Line two Line three|", "Unix line endings (\\n) converted to spaces" ); |
124 |
|
125 |
# Test Windows line endings (\r\n) |
126 |
my $field_windows = C4::SIP::Sip::add_field( "AF", "Line one\r\nLine two\r\nLine three" ); |
127 |
is( $field_windows, "AFLine one Line two Line three|", "Windows line endings (\\r\\n) converted to spaces" ); |
128 |
|
129 |
# Test Mac line endings (\r) |
130 |
my $field_mac = C4::SIP::Sip::add_field( "AF", "Line one\rLine two\rLine three" ); |
131 |
is( $field_mac, "AFLine one Line two Line three|", "Mac line endings (\\r) converted to spaces" ); |
132 |
|
133 |
# Test mixed line endings |
134 |
my $field_mixed = C4::SIP::Sip::add_field( "AF", "Line one\r\nLine two\nLine three\rLine four" ); |
135 |
is( $field_mixed, "AFLine one Line two Line three Line four|", "Mixed line endings converted to spaces" ); |
136 |
|
137 |
# Test no line endings (should remain unchanged) |
138 |
my $field_normal = C4::SIP::Sip::add_field( "AF", "Single line message" ); |
139 |
is( $field_normal, "AFSingle line message|", "Normal text without line endings unchanged" ); |
140 |
|
141 |
# Test empty and undefined values |
142 |
my $field_empty = C4::SIP::Sip::add_field( "AF", "" ); |
143 |
is( $field_empty, "AF|", "Empty value handled correctly" ); |
144 |
}; |