Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
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
 
# Copyright (c) 2024-2026, PostgreSQL Global Development Group
 
# Test the incremental (table-driven) json parser.
 
 
use strict;
use warnings FATAL => 'all';
 
use PostgreSQL::Test::Utils;
use Test::More;
use FindBin;
 
my $test_file = "$FindBin::RealBin/../tiny.json";
 
my @exes = (
    [ "test_json_parser_incremental", ],
    [ "test_json_parser_incremental", "-o", ],
    [ "test_json_parser_incremental_shlib", ],
    [ "test_json_parser_incremental_shlib", "-o", ]);
 
foreach my $exe (@exes)
{
    note "testing executable @$exe";
 
    # Test the  usage error
    my ($stdout, $stderr) = run_command([ @$exe, "-c", 10 ]);
    like($stderr, qr/Usage:/, 'error message if not enough arguments');
 
    # Test that we get success for small chunk sizes from 64 down to 1.
    for (my $size = 64; $size > 0; $size--)
    {
        ($stdout, $stderr) = run_command([ @$exe, "-c", $size, $test_file ]);
 
        like($stdout, qr/SUCCESS/, "chunk size $size: test succeeds");
        is($stderr, "", "chunk size $size: no error output");
    }
}
 
done_testing();