t5800-csv-date.pl 599 Bytes
Newer Older
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
#!/usr/bin/perl -w
# -----------------------------------------------------------------------------

use strict;
use lib ($0 =~ m|^(.*/)| ? $1 : ".");
use GnumericTest;

&message ("Check the csv importer.");

&test_csv_format_guessing
    (data => <<DATA, format => sub { /^d.*m.*y.*$/i; } );
"Date"
"1/2/3"
"1/2/2000"
"31/12/2000"
DATA

&test_csv_format_guessing
    (data => <<DATA, format => sub { /^m.*d.*y.*$/i; } );
"Date"
"1/2/3"
"1/2/2000"
"12/31/2000"
DATA

&test_csv_format_guessing
    (data => <<DATA, format => sub { /^y.*m.*d.*$/i; } );
"Date"
"2000-12-01"
DATA

print STDERR "Pass\n";