1# ==== Purpose ====
2#
3# Asserts that the current session has no warnings or threw only
4# expected warnings.
5#
6# ==== Usage ====
7#
8# [--let $assert_no_warnings_exception= NUMBER ]
9#  or
10# [--let $assert_no_warnings_exception= convert_error(ER_...) ]
11# --source include/assert_no_warnings.inc
12#
13# Parameters:
14#
15#   $assert_no_warnings_exception
16#     The error code of a possible expected warning to avoid failing this
17#     assert on expected warnings.
18#
19
20--let $_warning_rows= `SHOW COUNT(*) WARNINGS`
21--let $_warning_counter= 1
22
23while ( $_warning_counter <= $_warning_rows )
24{
25  --let $_warning_error_code= query_get_value("SHOW WARNINGS", Code, $_warning_counter)
26  if ( $_warning_error_code != $assert_no_warnings_exception )
27  {
28    if ($assert_no_warnings_exception)
29    {
30      --echo assert_no_warnings.inc exception : $assert_no_warnings_exception
31    }
32    SHOW WARNINGS;
33    --die assert_no_warnings.inc has found a unexpected warning
34  }
35  --inc $_warning_counter
36}
37