File: json-crlf.t

package info (click to toggle)
libyaml-syck-perl 1.20-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 932 kB
  • sloc: ansic: 3,987; perl: 3,387; makefile: 4
file content (32 lines) | stat: -rw-r--r-- 575 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
20
21
22
23
24
25
26
27
28
29
30
31
32
use strict;
use t::TestYAML ();
use Test::More tests => 6;

use JSON::Syck;

{
	$JSON::Syck::SingleQuote = 0;

	my $cr = JSON::Syck::Dump({ foo => "\r" });
	like $cr, qr/"\\r"/;

	my $lf = JSON::Syck::Dump({ foo => "\n" });
	like $lf, qr/"\\n"/;

	my $crlf = JSON::Syck::Dump({ foo => "\r\n" });
	like $crlf, qr/"\\r\\n"/;
}

{
	$JSON::Syck::SingleQuote = 1;

	my $cr = JSON::Syck::Dump({ foo => "\r" });
	like $cr, qr/'\\r'/;

	my $lf = JSON::Syck::Dump({ foo => "\n" });
	like $lf, qr/'\\n'/;

	my $crlf = JSON::Syck::Dump({ foo => "\r\n" });
	like $crlf, qr/'\\r\\n'/;
}