You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
proxysql/test/tap/t/todotap.my

128 lines
3.7 KiB

BEGIN;
SELECT tap.plan(21);
-- CALL tap.no_plan();
/****************************************************************************/
-- Test todo tests.
SELECT 'ok 1 - todo fail
ok 2 - todo pass';
CALL tap.todo(2, 'just because');
SELECT tap.eq(
concat(tap.fail('This is a todo test' ), '
', tap.pass('This is a todo test that unexpectedly passes' )),
'not ok 1 - This is a todo test # TODO just because
# Failed (TODO) test 1: "This is a todo test"
ok 2 - This is a todo test that unexpectedly passes # TODO just because',
'TODO tests should display properly'
);
/****************************************************************************/
-- Test skipping tests.
SELECT tap.check_test(
tap.skip(1, 'Just because'),
1,
'simple skip',
'SKIP: Just because',
'',
0
);
SELECT 'ok 7 - Skip multiple
ok 8 - Skip multiple
ok 9 - Skip multiple';
SELECT tap.eq(
tap.skip( 3, 'Whatever' ),
'ok 7 - SKIP: Whatever
ok 8 - SKIP: Whatever
ok 9 - SKIP: Whatever',
'We should get the proper output for multiple skips'
);
/****************************************************************************/
-- Try nesting todo tests.
SELECT 'ok 11 - todo fail
ok 12 - todo fail
ok 13 - todo fail';
CALL tap.todo(2, 'just because');
SET @tap = tap.fail('This is a todo test 1');
CALL tap.todo(1, 'inside');
SELECT tap.eq(
concat(
@tap, '\n',
tap.fail('This is a todo test 2'), '\n',
tap.fail('This is a todo test 3')
),
'not ok 11 - This is a todo test 1 # TODO just because
# Failed (TODO) test 11: "This is a todo test 1"
not ok 12 - This is a todo test 2 # TODO inside
# Failed (TODO) test 12: "This is a todo test 2"
not ok 13 - This is a todo test 3 # TODO just because
# Failed (TODO) test 13: "This is a todo test 3"',
'Nested todos should work properly'
);
UPDATE tap.__tresults__ SET ok = 1, aok = 1 WHERE numb IN( 11, 12, 13 ) AND cid = connection_id();
/****************************************************************************/
-- Test todo_start() and todo_end().
SELECT 'ok 15 - todo fail
ok 16 - todo fail
ok 17 - todo fail';
CALL tap.todo_start('some todos');
SET @tap = concat(
tap.fail('This is a todo test 1'), '\n',
tap.in_todo()
);
CALL tap.todo(1, 'inside');
SET @tap = concat(
@tap, '\n',
tap.fail('This is a todo test 2'), '\n',
tap.fail('This is a todo test 3')
);
CALL tap.todo_end();
SET @tap = concat(
@tap, '\n', tap.in_todo()
);
SELECT tap.eq(
@tap,
'not ok 15 - This is a todo test 1 # TODO some todos
# Failed (TODO) test 15: "This is a todo test 1"
1
not ok 16 - This is a todo test 2 # TODO inside
# Failed (TODO) test 16: "This is a todo test 2"
not ok 17 - This is a todo test 3 # TODO some todos
# Failed (TODO) test 17: "This is a todo test 3"
0',
'todo_start() and todo_end() should work properly with in_todo()'
);
UPDATE tap.__tresults__ SET ok = 1, aok = 1 WHERE numb IN( 15, 16, 17 ) AND cid = connection_id();
/****************************************************************************/
-- Make sure we can reverse the arguments.
SELECT 'ok 19 - todo fail
ok 20 - todo pass';
CALL tap.todo(2, 'just because' );
SELECT tap.eq(
concat(tap.fail('This is a todo test' ), '
', tap.fail('Another todo test')),
'not ok 19 - This is a todo test # TODO just because
# Failed (TODO) test 19: "This is a todo test"
not ok 20 - Another todo test # TODO just because
# Failed (TODO) test 20: "Another todo test"',
'Should be able to revers the arguments to todo()'
);
UPDATE tap.__tresults__ SET ok = true, aok = true WHERE numb IN( 19, 20 ) AND cid = connection_id();
/****************************************************************************/
-- Finish the tests and clean up.
CALL tap.finish();
ROLLBACK;