File: utf8.t

package info (click to toggle)
libtest2-harness-perl 1.000151-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,888 kB
  • sloc: perl: 16,994; ansic: 6; sh: 4; makefile: 3
file content (24 lines) | stat: -rw-r--r-- 700 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
use utf8;
use Test2::V0;
use Test2::Plugin::UTF8;
use Test2::API qw/test2_stack/;
use Test2::Harness::Util::JSON qw/decode_json/;
use Test2::Util qw/get_tid ipc_separator/;
# HARNESS-DURATION-SHORT

test2_stack()->top;
my ($hub) = test2_stack()->all();
my $fmt = $hub->format;
skip_all "This test requires the stream formatter"
    unless $fmt && $fmt->isa('Test2::Formatter::Stream');

ok(1, "І ще трохи");

my $file = File::Spec->catfile($fmt->dir, join(ipc_separator() => 'events', $$, 0) . ".jsonl");
open(my $fh, '<:utf8', $file) or die "Could not open events file: $!";

my @lines = <$fh>;

like($lines[-1], qr/\QІ ще трохи\E/, "Wrote utf8, not double encoded");

done_testing;