1use strict;
2use warnings;
3use v5.10;
4use Scalar::Util 'blessed';
5use Test::More tests => 6;
6BEGIN { use_ok('Geo::GDAL') };
7
8my $e;
9
10eval {
11    my $ds = Geo::GDAL::Driver('GTiff')->Create(Name => '/vsimem/tmp', Bands => 0);
12};
13ok(($@ =~ /called at t\/error.t/), "Error in GDAL is confessed (by a call in cpl_exceptions.i).");
14
15eval {
16    Geo::GDAL::VSIF::MkDir('/cannot/make/this');
17};
18ok(($@ =~ /called at t\/error.t/), "Error in bindings is confessed (by a call in typemaps_perl.i).");
19
20Geo::GDAL->errstr;
21$e = Geo::GDAL->errstr;
22ok($e eq '', 'Calling Geo::GDAL::errstr clears the error stack.');
23
24eval {
25    Geo::GDAL::GetDataTypeSize('bar');
26};
27ok(($@ =~ /called at t\/error.t/), "Error in Perl layer is confessed (by a call to Geo::GDAL::error in {gdal,ogr,osr}_perl.i).");
28
29$e = Geo::GDAL->errstr;
30ok($@ =~ /$e/, 'Pure errors can be obtained from Geo::GDAL::errstr');
31