Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 91187a17a4
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (25 sloc) 0.886 kb
use strict;
use warnings;
use Test::More tests => 4;
use SQL::Beautify;
my $sql = new SQL::Beautify(
spaces => 2,
wrap => {
keywords => [ "\x1B[0;32m", "\x1B[0m" ],
constants => [ "\x1B[0;31m", "\x1B[0m" ],
my $query;
my $beauty;
ok($sql, 'got instance');
# Test plain text formatting.
$query = <DATA>;
$beauty = <DATA>;
$beauty = eval $beauty;
ok($sql->query($query) eq $query, 'query set');
ok($sql->query eq $query, 'query get');
ok($sql->beautify eq $beauty, 'beautified');
SELECT * FROM foo, bar, baz WHERE = AND = AND = 'quux' AND = 42
"\e[0;32mSELECT\e[0m\n *\n\e[0;32mFROM\e[0m\n foo,\n bar,\n baz\n\e[0;32mWHERE\e[0m\n =\n \e[0;32mAND\e[0m\n =\n \e[0;32mAND\e[0m\n = \e[0;31m'quux'\e[0m\n \e[0;32mAND\e[0m\n = \e[0;31m42\e[0m\n"
Jump to Line
Something went wrong with that request. Please try again.