File: cstring.t

package info (click to toggle)
libxstring-perl 0.005-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 716 kB
  • sloc: perl: 224; makefile: 8
file content (47 lines) | stat: -rw-r--r-- 805 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl -w

# Copyright (c) 2018, cPanel, LLC.
# All rights reserved.
# http://cpanel.net
#
# This is free software; you can redistribute it and/or modify it under the
# same terms as Perl itself. See L<perlartistic>.

use strict;
use warnings;

use Test::More;

use XString ();

use B ();

my @strings = (
    q[OneWord],
    q[with space],
    q[using-dash],
    q['some"quotes],
    q['abcd'],
    q["abcd"],
    qq[new\nlines\n],
    qq[end\0character],
    qq[beep\007],
    map { chr } 0..128
);

{
    #note "testing cstring";
    foreach my $str ( @strings ) {
        is B::cstring( $str ), XString::cstring( $str );
    }
}

{
    #note "testing perlstring";
    foreach my $str ( @strings ) {
        is B::perlstring( $str ), XString::perlstring( $str );
    }    
}


done_testing();