Fix pt-find.t by using new stored code that was removed from the new sakila.sql.

This commit is contained in:
Daniel Nichter
2012-12-05 14:45:56 -07:00
parent dd333380f2
commit 2687857550
2 changed files with 46 additions and 14 deletions

View File

@@ -0,0 +1,30 @@
DROP DATABASE IF EXISTS pt_find;
CREATE DATABASE pt_find;
USE pt_find;
create table t1 (
id int not null primary key
) engine=innodb;
create table t2 (
id int not null primary key
) engine=innodb;
CREATE FUNCTION hello (s CHAR(20))
RETURNS CHAR(50) DETERMINISTIC
RETURN CONCAT('Hello, ',s,'!');
delimiter //
CREATE PROCEDURE simpleproc (OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM t;
END//
CREATE TRIGGER ins_trg BEFORE INSERT ON t1
FOR EACH ROW BEGIN
INSERT INTO t2 VALUES (NEW.id);
END;
//
delimiter ;

View File

@@ -26,6 +26,8 @@ else {
plan tests => 23;
}
$sb->load_file('master', 't/lib/samples/stored-objs.sql');
my $output;
my $cnf = '/tmp/12345/my.sandbox.cnf';
my $cmd = "$trunk/bin/pt-find -F $cnf ";
@@ -112,14 +114,14 @@ SKIP: {
);
# Test --procedure.
$output = `$cmd sakila --procedure min_monthly_purchases --print`;
$output = `$cmd pt_find --procedure param1 --print`;
is(
$output,
"`sakila`.`PROCEDURE rewards_report`\n",
"`pt_find`.`PROCEDURE simpleproc`\n",
'--procedure that matches'
);
$output = `$cmd sakila --procedure blah --print`;
$output = `$cmd pt_find --procedure blah --print`;
is(
$output,
'',
@@ -127,14 +129,14 @@ SKIP: {
);
# Test --function.
$output = `$cmd sakila --function v_out --print`;
$output = `$cmd pt_find --function Hello --print`;
is(
$output,
"`sakila`.`FUNCTION inventory_in_stock`\n",
"`pt_find`.`FUNCTION hello`\n",
'--function that matches'
);
$output = `$cmd sakila --function blah --print`;
$output = `$cmd pt_find --function blah --print`;
is(
$output,
'',
@@ -142,14 +144,14 @@ SKIP: {
);
# Test --trigger without --trigger-table.
$output = `$cmd sakila --trigger 'UPDATE film_text' --print`;
$output = `$cmd pt_find --trigger 'INSERT INTO t2' --print`;
is(
$output,
"`sakila`.`UPDATE TRIGGER upd_film on film`\n",
"`pt_find`.`INSERT TRIGGER ins_trg on t1`\n",
'--trigger that matches without --trigger-table'
);
$output = `$cmd sakila --trigger blah --print`;
$output = `$cmd pt_find --trigger blah --print`;
is(
$output,
'',
@@ -157,28 +159,28 @@ SKIP: {
);
# Test --trigger with --trigger-table.
$output = `$cmd sakila --trigger 'UPDATE film_text' --trigger-table film --print`;
$output = `$cmd pt_find --trigger 'INSERT INTO t2' --trigger-table t1 --print`;
is(
$output,
"`sakila`.`UPDATE TRIGGER upd_film on film`\n",
"`pt_find`.`INSERT TRIGGER ins_trg on t1`\n",
'--trigger that matches with matching --trigger-table'
);
$output = `$cmd sakila --trigger blah --trigger-table film --print`;
$output = `$cmd pt_find --trigger blah --trigger-table t1 --print`;
is(
$output,
'',
"--trigger that doesn't match with matching --trigger-table"
);
$output = `$cmd sakila --trigger 'UPDATE film_text' --trigger-table foo --print`;
$output = `$cmd pt_find --trigger 'INSERT INTO t2' --trigger-table foo --print`;
is(
$output,
'',
'--trigger that matches with non-matching --trigger-table'
);
$output = `$cmd sakila --trigger blah --trigger-table foo --print`;
$output = `$cmd pt_find --trigger blah --trigger-table foo --print`;
is(
$output,
'',