[Bast-commits] r9677 - in SQL-Abstract/1.x/branches/sqla-tree: . t
frew at dev.catalyst.perl.org
frew at dev.catalyst.perl.org
Sat Sep 4 01:22:34 GMT 2010
Author: frew
Date: 2010-09-04 02:22:34 +0100 (Sat, 04 Sep 2010)
New Revision: 9677
Modified:
SQL-Abstract/1.x/branches/sqla-tree/Makefile.PL
SQL-Abstract/1.x/branches/sqla-tree/t/11unparse.t
Log:
test for no formatting
Modified: SQL-Abstract/1.x/branches/sqla-tree/Makefile.PL
===================================================================
--- SQL-Abstract/1.x/branches/sqla-tree/Makefile.PL 2010-09-04 01:12:46 UTC (rev 9676)
+++ SQL-Abstract/1.x/branches/sqla-tree/Makefile.PL 2010-09-04 01:22:34 UTC (rev 9677)
@@ -13,7 +13,7 @@
requires 'List::Util' => 0;
requires 'Scalar::Util' => 0;
-test_requires "Test::More" => 0;
+test_requires "Test::More" => 0.96;
test_requires "Test::Exception" => 0;
test_requires "Test::Warn" => 0;
test_requires "Storable" => 0; # for cloning in tests
Modified: SQL-Abstract/1.x/branches/sqla-tree/t/11unparse.t
===================================================================
--- SQL-Abstract/1.x/branches/sqla-tree/t/11unparse.t 2010-09-04 01:12:46 UTC (rev 9676)
+++ SQL-Abstract/1.x/branches/sqla-tree/t/11unparse.t 2010-09-04 01:22:34 UTC (rev 9677)
@@ -4,48 +4,84 @@
use Test::More;
use SQL::Abstract::Tree;
-my $sqlat = SQL::Abstract::Tree->new({
- profile => 'console_monochrome',
-});
+subtest no_formatting => sub {
+ my $sqlat = SQL::Abstract::Tree->new;
-{
- my $sql = "SELECT a, b, c FROM foo WHERE foo.a =1 and foo.b LIKE 'station'";
- my $expected_sql =
- qq{SELECT a, b, c \n} .
- qq{ FROM foo \n} .
- qq{ WHERE foo.a = 1 AND foo.b LIKE 'station' };
- is($sqlat->format($sql), $expected_sql,
- 'simple statement formatted correctly'
- );
-}
+ {
+ my $sql = "SELECT a, b, c FROM foo WHERE foo.a =1 and foo.b LIKE 'station'";
+ my $expected_sql =
+ "SELECT a, b, c FROM foo WHERE foo.a = 1 AND foo.b LIKE 'station' ";
+ is($sqlat->format($sql), $expected_sql,
+ 'simple statement formatted correctly'
+ );
+ }
-{
- my $sql = "SELECT * FROM (SELECT * FROM foobar) WHERE foo.a =1 and foo.b LIKE 'station'";
- my $expected_sql =
- qq{SELECT * \n} .
- qq{ FROM (\n} .
- qq{ SELECT * \n} .
- qq{ FROM foobar \n} .
- qq{ ) \n} .
- qq{ WHERE foo.a = 1 AND foo.b LIKE 'station' };
+ {
+ my $sql = "SELECT * FROM (SELECT * FROM foobar) WHERE foo.a =1 and foo.b LIKE 'station'";
+ my $expected_sql =
+ "SELECT * FROM (SELECT * FROM foobar ) WHERE foo.a = 1 AND foo.b LIKE 'station' ";
+ is($sqlat->format($sql), $expected_sql,
+ 'subquery statement formatted correctly'
+ );
+ }
- is($sqlat->format($sql), $expected_sql,
- 'subquery statement formatted correctly'
- );
-}
+ {
+ my $sql = "SELECT * FROM lolz WHERE ( foo.a =1 ) and foo.b LIKE 'station'";
+ my $expected_sql =
+ "SELECT * FROM lolz WHERE (foo.a = 1) AND foo.b LIKE 'station' ";
-{
- my $sql = "SELECT * FROM lolz WHERE ( foo.a =1 ) and foo.b LIKE 'station'";
- my $expected_sql =
- qq{SELECT * \n} .
- qq{ FROM lolz \n} .
- qq{ WHERE (foo.a = 1) AND foo.b LIKE 'station' };
+ is($sqlat->format($sql), $expected_sql,
+ 'simple statement with parens in where formatted correctly'
+ );
+ }
+ done_testing;
+};
- is($sqlat->format($sql), $expected_sql,
- 'simple statement with parens in where formatted correctly'
- );
-}
+subtest console_monochrome => sub {
+ my $sqlat = SQL::Abstract::Tree->new({
+ profile => 'console_monochrome',
+ });
+ {
+ my $sql = "SELECT a, b, c FROM foo WHERE foo.a =1 and foo.b LIKE 'station'";
+ my $expected_sql =
+ qq{SELECT a, b, c \n} .
+ qq{ FROM foo \n} .
+ qq{ WHERE foo.a = 1 AND foo.b LIKE 'station' };
+ is($sqlat->format($sql), $expected_sql,
+ 'simple statement formatted correctly'
+ );
+ }
+
+ {
+ my $sql = "SELECT * FROM (SELECT * FROM foobar) WHERE foo.a =1 and foo.b LIKE 'station'";
+ my $expected_sql =
+ qq{SELECT * \n} .
+ qq{ FROM (\n} .
+ qq{ SELECT * \n} .
+ qq{ FROM foobar \n} .
+ qq{ ) \n} .
+ qq{ WHERE foo.a = 1 AND foo.b LIKE 'station' };
+
+ is($sqlat->format($sql), $expected_sql,
+ 'subquery statement formatted correctly'
+ );
+ }
+
+ {
+ my $sql = "SELECT * FROM lolz WHERE ( foo.a =1 ) and foo.b LIKE 'station'";
+ my $expected_sql =
+ qq{SELECT * \n} .
+ qq{ FROM lolz \n} .
+ qq{ WHERE (foo.a = 1) AND foo.b LIKE 'station' };
+
+ is($sqlat->format($sql), $expected_sql,
+ 'simple statement with parens in where formatted correctly'
+ );
+ }
+ done_testing;
+};
+
done_testing;
# stuff we want:
# Nested indentation
More information about the Bast-commits
mailing list