From: Arthur Axel 'fREW' Schmidt Date: Mon, 2 May 2011 23:25:03 +0000 (-0500) Subject: rename Shim to ProducerUtils for accuracy X-Git-Tag: v0.11008~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f3fccb750c0cd2471086751ee81edab2d9109c72;p=dbsrgits%2FSQL-Translator.git rename Shim to ProducerUtils for accuracy --- diff --git a/lib/SQL/Translator/Producer/SQLServer.pm b/lib/SQL/Translator/Producer/SQLServer.pm index 29058ba..bbd46da 100644 --- a/lib/SQL/Translator/Producer/SQLServer.pm +++ b/lib/SQL/Translator/Producer/SQLServer.pm @@ -60,9 +60,9 @@ $DEBUG = 1 unless defined $DEBUG; use Data::Dumper; use SQL::Translator::Schema::Constants; use SQL::Translator::Utils qw(debug header_comment); -use SQL::Translator::Shim; +use SQL::Translator::ProducerUtils; -my $shim = SQL::Translator::Shim->new( quote_chars => ['[', ']'] ); +my $util = SQL::Translator::ProducerUtils->new( quote_chars => ['[', ']'] ); my %translate = ( date => 'datetime', @@ -403,7 +403,7 @@ sub mk_name { } # ------------------------------------------------------------------- -sub unreserve { $shim->quote($_[0]) } +sub unreserve { $util->quote($_[0]) } 1; diff --git a/lib/SQL/Translator/Shim.pm b/lib/SQL/Translator/ProducerUtils.pm similarity index 96% rename from lib/SQL/Translator/Shim.pm rename to lib/SQL/Translator/ProducerUtils.pm index b9b3b5f..f90ff3a 100644 --- a/lib/SQL/Translator/Shim.pm +++ b/lib/SQL/Translator/ProducerUtils.pm @@ -1,4 +1,4 @@ -package SQL::Translator::Shim; +package SQL::Translator::ProducerUtils; use Moo; use Sub::Quote 'quote_sub'; diff --git a/t/65-producerutils.t b/t/65-producerutils.t new file mode 100644 index 0000000..3e1c93c --- /dev/null +++ b/t/65-producerutils.t @@ -0,0 +1,27 @@ +use strict; +use warnings; + +use Test::More; + +use SQL::Translator::ProducerUtils; + +my $util = SQL::Translator::ProducerUtils->new( + quote_chars => ['[', ']'], +); + +is $util->quote('frew'), '[frew]', 'simple quote works'; +is $util->quote('people.frew'), '[people].[frew]', 'namespaced quote works'; + +my $single_util = SQL::Translator::ProducerUtils->new( + quote_chars => q(|), +); + +is $single_util->quote('frew'), '|frew|', 'simple single quote works'; +is $single_util->quote('people.frew'), '|people|.|frew|', 'namespaced single quote works'; + +my $no_util = SQL::Translator::ProducerUtils->new(); + +is $no_util->quote('frew'), 'frew', 'simple no quote works'; +is $no_util->quote('people.frew'), 'people.frew', 'namespaced no quote works'; + +done_testing; diff --git a/t/65-shim.t b/t/65-shim.t deleted file mode 100644 index 23545c5..0000000 --- a/t/65-shim.t +++ /dev/null @@ -1,27 +0,0 @@ -use strict; -use warnings; - -use Test::More; - -use SQL::Translator::Shim; - -my $shim = SQL::Translator::Shim->new( - quote_chars => ['[', ']'], -); - -is $shim->quote('frew'), '[frew]', 'simple quote works'; -is $shim->quote('people.frew'), '[people].[frew]', 'namespaced quote works'; - -my $single_shim = SQL::Translator::Shim->new( - quote_chars => q(|), -); - -is $single_shim->quote('frew'), '|frew|', 'simple single quote works'; -is $single_shim->quote('people.frew'), '|people|.|frew|', 'namespaced single quote works'; - -my $no_shim = SQL::Translator::Shim->new(); - -is $no_shim->quote('frew'), 'frew', 'simple no quote works'; -is $no_shim->quote('people.frew'), 'people.frew', 'namespaced no quote works'; - -done_testing;