File: 06slash-n.t

package info (click to toggle)
libstring-format-perl 1.18-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 132 kB
  • sloc: perl: 173; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 536 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!perl
use strict;
use warnings;
use Test::More 'no_plan';

use String::Format;

my $unknown_fmt = "This is awesome.%x";
is(stringf($unknown_fmt), $unknown_fmt, "unknown %-entities are left intact");

my $with_n = "End in n.%n";
is(stringf($with_n), "End in n.\n", '%s becomes \n');

is(stringf($with_n, n => undef), 'End in n.%n', '(n=>undef) and %n untouched');

is(stringf($with_n, n => '%n'), 'End in n.%n', '(n=>%n) and %n still %n');

my $with_nl = "Newline!\n";
is(stringf($with_nl), "Newline!\n", '\n in string is unmolested');