support quoted PostgreSQL schema names with special chars (RT#64766)
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / Utils.pm
index 22a2194..667caee 100644 (file)
@@ -8,7 +8,7 @@ use Test::More;
 use namespace::clean;
 use Exporter 'import';
 
-our @EXPORT_OK = qw/split_name dumper dumper_squashed eval_package_without_redefine_warnings class_path warnings_exist warnings_exist_silent/;
+our @EXPORT_OK = qw/split_name dumper dumper_squashed eval_package_without_redefine_warnings class_path no_warnings warnings_exist warnings_exist_silent/;
 
 use constant BY_CASE_TRANSITION =>
     qr/(?<=[[:lower:]\d])[\W_]*(?=[[:upper:]])|[\W_]+/;
@@ -84,6 +84,22 @@ sub class_path {
     return $class_path;
 }
 
+sub no_warnings(&;$) {
+    my ($code, $test_name) = @_;
+
+    my $failed = 0;
+
+    my $warn_handler = $SIG{__WARN__} || sub { warn @_ };
+    local $SIG{__WARN__} = sub {
+        $failed = 1;
+        $warn_handler->(@_);
+    };
+
+    $code->();
+
+    ok ((not $failed), $test_name);
+}
+
 sub warnings_exist(&$$) {
     my ($code, $re, $test_name) = @_;