X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F14roundtrippin.t;h=63fb7a48727e517f175ec527da742aad45a92b9a;hb=7cc4731935b0b0e60c7d4ebe44512de74de5dc3c;hp=ebbca331e05de708f51957a0365329d66c345fd3;hpb=efc991a0345e071e54a205ab938c0baf3f6e3380;p=scpubgit%2FQ-Branch.git diff --git a/t/14roundtrippin.t b/t/14roundtrippin.t index ebbca33..63fb7a4 100644 --- a/t/14roundtrippin.t +++ b/t/14roundtrippin.t @@ -10,14 +10,21 @@ my @sql = ( "INSERT INTO artist DEFAULT VALUES", "INSERT INTO artist VALUES ()", "SELECT a, b, c FROM foo WHERE foo.a =1 and foo.b LIKE 'station'", - "SELECT * FROM (SELECT * FROM foobar) WHERE foo.a =1 and foo.b LIKE 'station'", + "SELECT COUNT( * ) FROM foo", + "SELECT * FROM (SELECT * FROM foobar) WHERE foo.a = 1 and foo.b LIKE 'station'", "SELECT * FROM lolz WHERE ( foo.a =1 ) and foo.b LIKE 'station'", "SELECT [screen].[id], [screen].[name], [screen].[section_id], [screen].[xtype] FROM [users_roles] [me] JOIN [roles] [role] ON [role].[id] = [me].[role_id] JOIN [roles_permissions] [role_permissions] ON [role_permissions].[role_id] = [role].[id] JOIN [permissions] [permission] ON [permission].[id] = [role_permissions].[permission_id] JOIN [permissionscreens] [permission_screens] ON [permission_screens].[permission_id] = [permission].[id] JOIN [screens] [screen] ON [screen].[id] = [permission_screens].[screen_id] WHERE ( [me].[user_id] = ? ) GROUP BY [screen].[id], [screen].[name], [screen].[section_id], [screen].[xtype]", + "SELECT * FROM foo WHERE NOT EXISTS (SELECT bar FROM baz)", ); for (@sql) { - is_same_sql($_, $sqlat->format($_), 'roundtrip works'); + # Needs whitespace preservation in the AST to work, pending + #local $SQL::Abstract::Test::mysql_functions = 1; + is_same_sql ($sqlat->format($_), $_, sprintf 'roundtrip works (%s...)', substr $_, 0, 20); } +# delete this test when mysql_functions gets implemented +my $sql = 'SELECT COUNT( * ) FROM foo'; +is($sqlat->format($sql), $sql, 'Roundtripping to mysql-compatible paren. syntax'); done_testing;